类 TypeMismatchException
- 所有已实现的接口:
Serializable
public class TypeMismatchException extends PropertyAccessException
Exception thrown on a type mismatch when trying to set a bean property.- 作者:
- Rod Johnson, Juergen Hoeller
- 另请参阅:
- 序列化表格
字段概要
字段 修饰符和类型 字段 说明 static String
ERROR_CODE
Error code that a type mismatch error will be registered with.
构造器概要
构造器 构造器 说明 TypeMismatchException(PropertyChangeEvent propertyChangeEvent, Class<?> requiredType)
Create a newTypeMismatchException
.TypeMismatchException(PropertyChangeEvent propertyChangeEvent, Class<?> requiredType, Throwable cause)
Create a newTypeMismatchException
.TypeMismatchException(Object value, Class<?> requiredType)
Create a newTypeMismatchException
without aPropertyChangeEvent
.TypeMismatchException(Object value, Class<?> requiredType, Throwable cause)
Create a newTypeMismatchException
without aPropertyChangeEvent
.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 String
getErrorCode()
Return a corresponding error code for this type of exception.String
getPropertyName()
Return the name of the affected property, if available.Class<?>
getRequiredType()
Return the required target type, if any.Object
getValue()
Return the offending value (may benull
).void
initPropertyName(String propertyName)
Initialize this exception's property name for exposure throughgetPropertyName()
, as an alternative to having it initialized via aPropertyChangeEvent
.从类继承的方法 org.springframework.beans.PropertyAccessException
getPropertyChangeEvent
从类继承的方法 org.springframework.core.NestedRuntimeException
contains, getMessage, getMostSpecificCause, getRootCause
字段详细资料
ERROR_CODE
public static final String ERROR_CODE
Error code that a type mismatch error will be registered with.- 另请参阅:
- 常量字段值
构造器详细资料
TypeMismatchException
public TypeMismatchException(PropertyChangeEvent propertyChangeEvent, Class<?> requiredType)
Create a newTypeMismatchException
.- 参数:
propertyChangeEvent
- the PropertyChangeEvent that resulted in the problemrequiredType
- the required target type
TypeMismatchException
public TypeMismatchException(PropertyChangeEvent propertyChangeEvent, @Nullable Class<?> requiredType, @Nullable Throwable cause)
Create a newTypeMismatchException
.- 参数:
propertyChangeEvent
- the PropertyChangeEvent that resulted in the problemrequiredType
- the required target type (ornull
if not known)cause
- the root cause (may benull
)
TypeMismatchException
public TypeMismatchException(@Nullable Object value, @Nullable Class<?> requiredType)
Create a newTypeMismatchException
without aPropertyChangeEvent
.- 参数:
value
- the offending value that couldn't be converted (may benull
)requiredType
- the required target type (ornull
if not known)- 另请参阅:
initPropertyName(java.lang.String)
TypeMismatchException
public TypeMismatchException(@Nullable Object value, @Nullable Class<?> requiredType, @Nullable Throwable cause)
Create a newTypeMismatchException
without aPropertyChangeEvent
.- 参数:
value
- the offending value that couldn't be converted (may benull
)requiredType
- the required target type (ornull
if not known)cause
- the root cause (may benull
)- 另请参阅:
initPropertyName(java.lang.String)
方法详细资料
initPropertyName
public void initPropertyName(String propertyName)
Initialize this exception's property name for exposure throughgetPropertyName()
, as an alternative to having it initialized via aPropertyChangeEvent
.- 参数:
propertyName
- the property name to expose- 从以下版本开始:
- 5.0.4
- 另请参阅:
TypeMismatchException(Object, Class)
,TypeMismatchException(Object, Class, Throwable)
getPropertyName
@Nullable public String getPropertyName()
Return the name of the affected property, if available.
getValue
@Nullable public Object getValue()
Return the offending value (may benull
).- 覆盖:
getValue
在类中PropertyAccessException
getRequiredType
@Nullable public Class<?> getRequiredType()
Return the required target type, if any.
- <