Class ObjectError
- All Implemented Interfaces:
- Serializable,- MessageSourceResolvable
- Direct Known Subclasses:
- FieldError
See the DefaultMessageCodesResolver javadoc for details on
 how a message code list is built for an ObjectError.
- Since:
- 10.03.2003
- Author:
- Juergen Hoeller
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionObjectError(String objectName, @Nullable String defaultMessage) Create a new instance of the ObjectError class.ObjectError(String objectName, String @Nullable [] codes, Object @Nullable [] arguments, @Nullable String defaultMessage) Create a new instance of the ObjectError class.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanCheck the source behind this error: possibly anException(typicallyPropertyAccessException) or a Bean ValidationConstraintViolation.booleanReturn the name of the affected object.inthashCode()toString()The default implementation exposes the attributes of this MessageSourceResolvable.<T> TUnwrap the source behind this error: possibly anException(typicallyPropertyAccessException) or a Bean ValidationConstraintViolation.voidPreserve the source behind this error: possibly anException(typicallyPropertyAccessException) or a Bean ValidationConstraintViolation.Methods inherited from class org.springframework.context.support.DefaultMessageSourceResolvablegetArguments, getCode, getCodes, getDefaultMessage, resolvableToString, shouldRenderDefaultMessage
- 
Constructor Details- 
ObjectErrorCreate a new instance of the ObjectError class.- Parameters:
- objectName- the name of the affected object
- defaultMessage- the default message to be used to resolve this message
 
- 
ObjectErrorpublic ObjectError(String objectName, String @Nullable [] codes, Object @Nullable [] arguments, @Nullable String defaultMessage) Create a new instance of the ObjectError class.- Parameters:
- objectName- the name of the affected object
- codes- the codes to be used to resolve this message
- arguments- the array of arguments to be used to resolve this message
- defaultMessage- the default message to be used to resolve this message
 
 
- 
- 
Method Details- 
getObjectNameReturn the name of the affected object.
- 
wrapPreserve the source behind this error: possibly anException(typicallyPropertyAccessException) or a Bean ValidationConstraintViolation.Note that any such source object is being stored as transient: that is, it won't be part of a serialized error representation. - Parameters:
- source- the source object
- Since:
- 5.0.4
 
- 
unwrapUnwrap the source behind this error: possibly anException(typicallyPropertyAccessException) or a Bean ValidationConstraintViolation.The cause of the outermost exception will be introspected as well, for example, the underlying conversion exception or exception thrown from a setter (instead of having to unwrap the PropertyAccessExceptionin turn).- Returns:
- the source object of the given type
- Throws:
- IllegalArgumentException- if no such source object is available (i.e. none specified or not available anymore after deserialization)
- Since:
- 5.0.4
 
- 
containsCheck the source behind this error: possibly anException(typicallyPropertyAccessException) or a Bean ValidationConstraintViolation.The cause of the outermost exception will be introspected as well, for example, the underlying conversion exception or exception thrown from a setter (instead of having to unwrap the PropertyAccessExceptionin turn).- Returns:
- whether this error has been caused by a source object of the given type
- Since:
- 5.0.4
 
- 
equals- Overrides:
- equalsin class- DefaultMessageSourceResolvable
 
- 
hashCodepublic int hashCode()- Overrides:
- hashCodein class- DefaultMessageSourceResolvable
 
- 
toStringDescription copied from class:DefaultMessageSourceResolvableThe default implementation exposes the attributes of this MessageSourceResolvable.To be overridden in more specific subclasses, potentially including the resolvable content through resolvableToString().- Overrides:
- toStringin class- DefaultMessageSourceResolvable
- See Also:
 
 
-