public final class LocalizableMessage extends Object implements Serializable, StaticStructure
LocalizableMessage
class represents a localizable string or message
template. Interfaces include one or more localizable message templates in the
exceptions they report so that clients can display diagnostic messages in the
native language of the user. Interfaces can include localizable strings in the
data returned from methods to allow clients to display localized status
information in the native language of the user.Constructor and Description |
---|
LocalizableMessage()
Default constructor.
|
LocalizableMessage(String id,
String defaultMessage,
List<String> args) |
Modifier and Type | Method and Description |
---|---|
<T extends Structure> |
_convertTo(Class<T> clazz)
Converts this structure into an instance of the provided class structure
if possible.
|
String |
_getCanonicalName()
Returns the canonical name of the structure.
|
static String |
_getCanonicalTypeName()
Returns the canonical type name.
|
static StructType |
_getClassType()
WARNING: Internal API, subject to change in future versions.
|
StructValue |
_getDataValue()
Returns this
Structure represented in the dynamic
DataValue model. |
DataValue |
_getDynamicField(String fieldName)
Get dynamic filed value.
|
Set<String> |
_getDynamicFieldNames()
Get the names of the dynamic fields in the structure.
|
StructType |
_getType()
WARNING: Internal API, subject to change in future versions.
|
boolean |
_hasTypeNameOf(Class<? extends Structure> clazz)
Checks that the runtime type name matches the type name from the binding
class.
|
static LocalizableMessage |
_newInstance(StructValue structValue)
WARNING: Internal API, subject to change in future versions.
Returns new instance of this binding class and injects the provided data value. WARNING: The returned object is not fully initialized. |
void |
_setDynamicField(String fieldName,
DataValue fieldValue)
Sets a dynamic field value.
|
void |
_validate()
Validates the state of the discriminated unions and HasFieldsOf
restrictions (if any) in this Java language binding
Structure . |
boolean |
equals(Object obj) |
List<String> |
getArgs()
Arguments to be substituted into a message template.
|
String |
getDefaultMessage()
The value of this localizable string or message template in the
en_US
(English) locale. |
String |
getId()
Unique identifier of the localizable string or message template.
|
int |
hashCode() |
void |
setArgs(List<String> args)
Arguments to be substituted into a message template.
|
void |
setDefaultMessage(String defaultMessage)
The value of this localizable string or message template in the
en_US
(English) locale. |
void |
setId(String id)
Unique identifier of the localizable string or message template.
|
String |
toString()
Returns a string representation of this structure.
|
public String getId()
This identifier is typically used to retrieve a locale-specific string or message template from a message catalog.
public void setId(String id)
This identifier is typically used to retrieve a locale-specific string or message template from a message catalog.
id
- New value for the property.public String getDefaultMessage()
en_US
(English) locale. If getId()
refers
to a message template, the default message will contain the substituted
arguments. This value can be used by clients that do not need to display strings
and messages in the native language of the user. It could also be used as a
fallback if a client is unable to access the appropriate message catalog.public void setDefaultMessage(String defaultMessage)
en_US
(English) locale. If getId()
refers
to a message template, the default message will contain the substituted
arguments. This value can be used by clients that do not need to display strings
and messages in the native language of the user. It could also be used as a
fallback if a client is unable to access the appropriate message catalog.defaultMessage
- New value for the property.public List<String> getArgs()
public void setArgs(List<String> args)
args
- New value for the property.public StructType _getType()
StaticStructure
StructType
instance representing the static bindings
type for this Structure
._getType
in interface StaticStructure
StructType
public StructValue _getDataValue()
Structure
Structure
represented in the dynamic
DataValue
model.
Attempts to change the returned StructValue
representation are not required to change the state of this structure.
Actually the behavior is implementation dependent and is unspecified.
In general the returned value shouldn't be changed.
_getDataValue
in interface Structure
StructValue
representing this structurepublic void _validate()
StaticStructure
Structure
.
More precisely, for each union: given value of the discriminant/tag
field (@UnionTag
in the IDL) of an union in this structure,
validates that:
_validate
in interface StaticStructure
public String toString()
StaticStructure
In general no code should depend on the format of the resulting string. E.g. there must be no attempts to parse for re-creation of the original instance.
toString
in interface StaticStructure
toString
in class Object
public boolean _hasTypeNameOf(Class<? extends Structure> clazz)
Structure
_hasTypeNameOf
in interface Structure
clazz
- type of the result structure. cannot be null.public <T extends Structure> T _convertTo(Class<T> clazz)
Structure
_convertTo
in interface Structure
clazz
- type of the result structure. cannot be null.CoreException
is thrown otherwise.public void _setDynamicField(String fieldName, DataValue fieldValue)
StaticStructure
_setDynamicField
in interface StaticStructure
fieldName
- canonical name of the dynamic field to setfieldValue
- the value of the fieldpublic DataValue _getDynamicField(String fieldName)
StaticStructure
_getDynamicField
in interface StaticStructure
fieldName
- the canonical name of the dynamic fieldDataValue
of the dynamic fieldpublic Set<String> _getDynamicFieldNames()
StaticStructure
_getDynamicFieldNames
in interface StaticStructure
public static StructType _getClassType()
StructType
instance representing the static bindings
type for this Structure
.public String _getCanonicalName()
Structure
org.example.FooBar
would turn into
org.example.foo_bar
._getCanonicalName
in interface Structure
public static String _getCanonicalTypeName()
_getCanonicalName()
.public static LocalizableMessage _newInstance(StructValue structValue)
structValue
- the source of the data contained in the binding object. Could
contain more data than fields of this class can describe i.e.
newer version of the binding object. Could be null.StructType
Copyright © 2015. All Rights Reserved.