T
- An enum type that defines the URNs this factory knows about.public abstract class AbstractMessageFactory<T extends java.lang.Enum<T>> extends java.lang.Object implements MessageFactory
Modifier | Constructor and Description |
---|---|
protected |
AbstractMessageFactory(java.lang.Class<T> clazz)
Constructor for AbstractMessageFactory.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String[] |
getKnownMessageURNs()
Get all message urns understood by this factory.
|
protected java.util.EnumSet<T> |
getKnownMessageURNsEnum()
Get an EnumSet containing known message URNs.
|
Message |
makeMessage(java.lang.String urn,
java.io.InputStream data)
Create a message based on its urn and populate it with data from a stream.
|
protected abstract Message |
makeMessage(T urn,
java.io.InputStream data)
Create a message based on its urn and populate it with data from a stream.
|
protected AbstractMessageFactory(java.lang.Class<T> clazz)
clazz
- The class of enum this factory uses.public java.lang.String[] getKnownMessageURNs()
MessageFactory
getKnownMessageURNs
in interface MessageFactory
public Message makeMessage(java.lang.String urn, java.io.InputStream data) throws java.io.IOException
MessageFactory
makeMessage
in interface MessageFactory
urn
- The urn of the message type to create.data
- An InputStream to read message data from.java.io.IOException
- If there is a problem reading the stream.protected java.util.EnumSet<T> getKnownMessageURNsEnum()
protected abstract Message makeMessage(T urn, java.io.InputStream data) throws java.io.IOException
urn
- The urn of the message type to create.data
- An InputStream to read message data from.java.io.IOException
- If there is a problem reading the stream.