Humboldt Alignment Editor 2.5.0

eu.esdihumboldt.hale.common.core.report.impl
Class AbstractMessageDefinition<T extends Message>

java.lang.Object
  extended by eu.esdihumboldt.hale.common.core.report.impl.AbstractMessageDefinition<T>
Type Parameters:
T - the message type
All Implemented Interfaces:
MessageDefinition<T>, ObjectDefinition<T>
Direct Known Subclasses:
InstanceValidationMessageDefinition, IOMessageImplDefinition, MessageImplDefinition, TransformationMessageImplDefinition

public abstract class AbstractMessageDefinition<T extends Message>
extends Object
implements MessageDefinition<T>

Abstract message definition

Author:
Simon Templer

Field Summary
static String KEY_MESSAGE
          Key for the message string
static String KEY_STACK_TRACE
          Key for the stack trace
 
Fields inherited from interface eu.esdihumboldt.hale.common.core.report.MessageDefinition
ID_PREFIX
 
Constructor Summary
AbstractMessageDefinition(Class<T> messageClass, String id)
          Create message definition
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_MESSAGE

public static final String KEY_MESSAGE
Key for the message string

See Also:
Constant Field Values

KEY_STACK_TRACE

public static final String KEY_STACK_TRACE
Key for the stack trace

See Also:
Constant Field Values
Constructor Detail

AbstractMessageDefinition

public AbstractMessageDefinition(Class<T> messageClass,
                                 String id)
Create message definition

Parameters:
messageClass - the message class
id - the identifier for the definition (without prefix)
Method Detail

getIdentifier

public String getIdentifier()
Description copied from interface: ObjectDefinition
Get the factory identifier. The identifier must be unique for object factories that have compatible supported types. It is used to associate a definition string to the factory. The identifier may not contain a :

Specified by:
getIdentifier in interface ObjectDefinition<T extends Message>
Returns:
the factory identifier
See Also:
ObjectDefinition.getIdentifier()

getObjectClass

public Class<T> getObjectClass()
Description copied from interface: ObjectDefinition
Get the class of the supported object.

Specified by:
getObjectClass in interface ObjectDefinition<T extends Message>
Returns:
the object class supported by this factory
See Also:
ObjectDefinition.getObjectClass()

parse

public T parse(String value)
Description copied from interface: ObjectDefinition
Parse the given definition string and create an object instance.

Specified by:
parse in interface ObjectDefinition<T extends Message>
Parameters:
value - the definition string to parse
Returns:
the CRS definition instance or null
See Also:
ObjectDefinition.parse(String)

createMessage

protected abstract T createMessage(Properties props)
Create a message from a set of properties

Parameters:
props - the properties
Returns:
the message

asString

public String asString(T message)
Description copied from interface: ObjectDefinition
Represent the given object as a definition string, so that it can be used to again create an object instance using ObjectDefinition.parse(String).

Specified by:
asString in interface ObjectDefinition<T extends Message>
Parameters:
message - the object to create a string representation for
Returns:
the string representation of the object
See Also:
ObjectDefinition.asString(Object)

asProperties

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).

Parameters:
message - the message
Returns:
the properties representing the message

Humboldt Alignment Editor 2.5.0

Build 2012-12-03_12-30-59
Revision 9d2dd4b0318cda9f1393b1ddd390f7f792d70a2d