T
- the message typepublic abstract class AbstractMessageDefinition<T extends Message> extends Object implements MessageDefinition<T>
Modifier and Type | Field and Description |
---|---|
static String |
KEY_MESSAGE
Key for the message string
|
static String |
KEY_STACK_TRACE
Key for the stack trace
|
ID_PREFIX
Constructor and Description |
---|
AbstractMessageDefinition(Class<T> messageClass,
String id)
Create message definition
|
Modifier and Type | Method and Description |
---|---|
protected Properties |
asProperties(T message)
Get a
Properties representation of the given message that can be
used to create a new message instance using
createMessage(Properties) . |
String |
asString(T message)
Represent the given object as a definition string, so that it can be used
to again create an object instance using
ObjectDefinition.parse(String) . |
protected abstract T |
createMessage(Properties props)
Create a message from a set of properties
|
String |
getIdentifier()
Get the factory identifier.
|
Class<T> |
getObjectClass()
Get the class of the supported object.
|
T |
parse(String value)
Parse the given definition string and create an object instance.
|
public static final String KEY_MESSAGE
public static final String KEY_STACK_TRACE
public String getIdentifier()
ObjectDefinition
:
getIdentifier
in interface ObjectDefinition<T extends Message>
ObjectDefinition.getIdentifier()
public Class<T> getObjectClass()
ObjectDefinition
getObjectClass
in interface ObjectDefinition<T extends Message>
ObjectDefinition.getObjectClass()
public T parse(String value)
ObjectDefinition
parse
in interface ObjectDefinition<T extends Message>
value
- the definition string to parsenull
ObjectDefinition.parse(String)
protected abstract T createMessage(Properties props)
props
- the propertiespublic String asString(T message)
ObjectDefinition
ObjectDefinition.parse(String)
.asString
in interface ObjectDefinition<T extends Message>
message
- the object to create a string representation forObjectDefinition.asString(Object)
protected Properties asProperties(T message)
Properties
representation of the given message that can be
used to create a new message instance using
createMessage(Properties)
.message
- the messageBuild 2013-10-07_11-27-38
Revision 99b27713a799a59a21b0b166eaaea8aaefbf125a