Spring Framework

org.springframework.beans
Class TypeMismatchException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by org.springframework.core.NestedRuntimeException
                  extended by org.springframework.beans.BeansException
                      extended by org.springframework.beans.PropertyAccessException
                          extended by org.springframework.beans.TypeMismatchException
All Implemented Interfaces:
java.io.Serializable, ErrorCoded
Direct Known Subclasses:
ConversionNotSupportedException

public class TypeMismatchException
extends PropertyAccessException

Exception thrown on a type mismatch when trying to set a bean property.

Author:
Rod Johnson, Juergen Hoeller
See Also:
Serialized Form

Field Summary
static java.lang.String ERROR_CODE
          Error code that a type mismatch error will be registered with.
 
Constructor Summary
TypeMismatchException(java.lang.Object value, java.lang.Class requiredType)
          Create a new TypeMismatchException without PropertyChangeEvent.
TypeMismatchException(java.lang.Object value, java.lang.Class requiredType, java.lang.Throwable cause)
          Create a new TypeMismatchException without PropertyChangeEvent.
TypeMismatchException(java.beans.PropertyChangeEvent propertyChangeEvent, java.lang.Class requiredType)
          Create a new TypeMismatchException.
TypeMismatchException(java.beans.PropertyChangeEvent propertyChangeEvent, java.lang.Class requiredType, java.lang.Throwable cause)
          Create a new TypeMismatchException.
 
Method Summary
 java.lang.String getErrorCode()
          Return the error code associated with this failure.
 java.lang.Class getRequiredType()
          Return the required target type, if any.
 java.lang.Object getValue()
          Return the offending value (may be null)
 
Methods inherited from class org.springframework.beans.PropertyAccessException
getPropertyChangeEvent, getPropertyName
 
Methods inherited from class org.springframework.beans.BeansException
equals, hashCode
 
Methods inherited from class org.springframework.core.NestedRuntimeException
contains, getMessage, getMostSpecificCause, getRootCause
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ERROR_CODE

public static final java.lang.String ERROR_CODE
Error code that a type mismatch error will be registered with.

See Also:
Constant Field Values
Constructor Detail

TypeMismatchException

public TypeMismatchException(java.beans.PropertyChangeEvent propertyChangeEvent,
                             java.lang.Class requiredType)
Create a new TypeMismatchException.

Parameters:
propertyChangeEvent - the PropertyChangeEvent that resulted in the problem
requiredType - the required target type

TypeMismatchException

public TypeMismatchException(java.beans.PropertyChangeEvent propertyChangeEvent,
                             java.lang.Class requiredType,
                             java.lang.Throwable cause)
Create a new TypeMismatchException.

Parameters:
propertyChangeEvent - the PropertyChangeEvent that resulted in the problem
requiredType - the required target type (or null if not known)
cause - the root cause (may be null)

TypeMismatchException

public TypeMismatchException(java.lang.Object value,
                             java.lang.Class requiredType)
Create a new TypeMismatchException without PropertyChangeEvent.

Parameters:
value - the offending value that couldn't be converted (may be null)
requiredType - the required target type (or null if not known)

TypeMismatchException

public TypeMismatchException(java.lang.Object value,
                             java.lang.Class requiredType,
                             java.lang.Throwable cause)
Create a new TypeMismatchException without PropertyChangeEvent.

Parameters:
value - the offending value that couldn't be converted (may be null)
requiredType - the required target type (or null if not known)
cause - the root cause (may be null)
Method Detail

getValue

public java.lang.Object getValue()
Return the offending value (may be null)

Overrides:
getValue in class PropertyAccessException

getRequiredType

public java.lang.Class getRequiredType()
Return the required target type, if any.


getErrorCode

public java.lang.String getErrorCode()
Description copied from interface: ErrorCoded
Return the error code associated with this failure. The GUI can render this any way it pleases, allowing for localization etc.

Returns:
a String error code associated with this failure, or null if not error-coded

Spring Framework