public class ObjectError extends DefaultMessageSourceResolvable
See the DefaultMessageCodesResolver javadoc for details on
how a message code list is built for an ObjectError.
FieldError,
DefaultMessageCodesResolver,
Serialized Form| Constructor and Description |
|---|
ObjectError(java.lang.String objectName,
java.lang.String defaultMessage)
Create a new instance of the ObjectError class.
|
ObjectError(java.lang.String objectName,
java.lang.String[] codes,
java.lang.Object[] arguments,
java.lang.String defaultMessage)
Create a new instance of the ObjectError class.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(java.lang.Class<?> sourceType)
Check the source behind this error: possibly an
Exception
(typically PropertyAccessException)
or a Bean Validation ConstraintViolation. |
boolean |
equals(java.lang.Object other) |
java.lang.String |
getObjectName()
Return the name of the affected object.
|
int |
hashCode() |
java.lang.String |
toString()
Default implementation exposes the attributes of this MessageSourceResolvable.
|
<T> T |
unwrap(java.lang.Class<T> sourceType)
Unwrap the source behind this error: possibly an
Exception
(typically PropertyAccessException)
or a Bean Validation ConstraintViolation. |
void |
wrap(java.lang.Object source)
Preserve the source behind this error: possibly an
Exception
(typically PropertyAccessException)
or a Bean Validation ConstraintViolation. |
getArguments, getCode, getCodes, getDefaultMessage, resolvableToStringpublic ObjectError(java.lang.String objectName,
java.lang.String defaultMessage)
objectName - the name of the affected objectdefaultMessage - the default message to be used to resolve this messagepublic ObjectError(java.lang.String objectName,
@Nullable
java.lang.String[] codes,
@Nullable
java.lang.Object[] arguments,
@Nullable
java.lang.String defaultMessage)
objectName - the name of the affected objectcodes - the codes to be used to resolve this messagearguments - the array of arguments to be used to resolve this messagedefaultMessage - the default message to be used to resolve this messagepublic java.lang.String getObjectName()
public void wrap(java.lang.Object source)
Exception
(typically PropertyAccessException)
or a Bean Validation ConstraintViolation.
Note that any such source object is being stored as transient: that is, it won't be part of a serialized error representation.
source - the source objectpublic <T> T unwrap(java.lang.Class<T> sourceType)
Exception
(typically PropertyAccessException)
or a Bean Validation ConstraintViolation.
The cause of the outermost exception will be introspected as well,
e.g. the underlying conversion exception or exception thrown from a setter
(instead of having to unwrap the PropertyAccessException in turn).
java.lang.IllegalArgumentException - if no such source object is available
(i.e. none specified or not available anymore after deserialization)public boolean contains(java.lang.Class<?> sourceType)
Exception
(typically PropertyAccessException)
or a Bean Validation ConstraintViolation.
The cause of the outermost exception will be introspected as well,
e.g. the underlying conversion exception or exception thrown from a setter
(instead of having to unwrap the PropertyAccessException in turn).
public boolean equals(@Nullable java.lang.Object other)
equals in class DefaultMessageSourceResolvablepublic int hashCode()
hashCode in class DefaultMessageSourceResolvablepublic java.lang.String toString()
DefaultMessageSourceResolvableresolvableToString().toString in class DefaultMessageSourceResolvableDefaultMessageSourceResolvable.resolvableToString()