public class DefaultMessageSourceResolvable extends java.lang.Object implements MessageSourceResolvable, java.io.Serializable
MessageSourceResolvable
interface.
Offers an easy way to store all the necessary values needed to resolve
a message via a MessageSource
.MessageSource.getMessage(MessageSourceResolvable, java.util.Locale)
,
Serialized FormConstructor and Description |
---|
DefaultMessageSourceResolvable(MessageSourceResolvable resolvable)
Copy constructor: Create a new instance from another resolvable.
|
DefaultMessageSourceResolvable(java.lang.String code)
Create a new DefaultMessageSourceResolvable.
|
DefaultMessageSourceResolvable(java.lang.String[] codes)
Create a new DefaultMessageSourceResolvable.
|
DefaultMessageSourceResolvable(java.lang.String[] codes,
java.lang.Object[] arguments)
Create a new DefaultMessageSourceResolvable.
|
DefaultMessageSourceResolvable(java.lang.String[] codes,
java.lang.Object[] arguments,
java.lang.String defaultMessage)
Create a new DefaultMessageSourceResolvable.
|
DefaultMessageSourceResolvable(java.lang.String[] codes,
java.lang.String defaultMessage)
Create a new DefaultMessageSourceResolvable.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object other) |
java.lang.Object[] |
getArguments()
Return the array of arguments to be used to resolve this message.
|
java.lang.String |
getCode()
Return the default code of this resolvable, that is,
the last one in the codes array.
|
java.lang.String[] |
getCodes()
Return the codes to be used to resolve this message, in the order that
they should get tried.
|
java.lang.String |
getDefaultMessage()
Return the default message to be used to resolve this message.
|
int |
hashCode() |
protected java.lang.String |
resolvableToString()
Build a default String representation for this MessageSourceResolvable:
including codes, arguments, and default message.
|
java.lang.String |
toString()
The default implementation exposes the attributes of this MessageSourceResolvable.
|
public DefaultMessageSourceResolvable(java.lang.String code)
code
- the code to be used to resolve this messagepublic DefaultMessageSourceResolvable(java.lang.String[] codes)
codes
- the codes to be used to resolve this messagepublic DefaultMessageSourceResolvable(java.lang.String[] codes, java.lang.String defaultMessage)
codes
- the codes to be used to resolve this messagedefaultMessage
- the default message to be used to resolve this messagepublic DefaultMessageSourceResolvable(java.lang.String[] codes, java.lang.Object[] arguments)
codes
- the codes to be used to resolve this messagearguments
- the array of arguments to be used to resolve this messagepublic DefaultMessageSourceResolvable(java.lang.String[] codes, java.lang.Object[] arguments, java.lang.String defaultMessage)
codes
- 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 DefaultMessageSourceResolvable(MessageSourceResolvable resolvable)
resolvable
- the resolvable to copy frompublic java.lang.String getCode()
public java.lang.String[] getCodes()
MessageSourceResolvable
getCodes
in interface MessageSourceResolvable
public java.lang.Object[] getArguments()
MessageSourceResolvable
getArguments
in interface MessageSourceResolvable
MessageFormat
public java.lang.String getDefaultMessage()
MessageSourceResolvable
getDefaultMessage
in interface MessageSourceResolvable
null
if no defaultprotected final java.lang.String resolvableToString()
public java.lang.String toString()
To be overridden in more specific subclasses, potentially including the
resolvable content through resolvableToString()
.
toString
in class java.lang.Object
resolvableToString()
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object