Package org.whiteflagprotocol.java.core
Class WfMessageCreator
java.lang.Object
org.whiteflagprotocol.java.core.WfMessageCreator
Whiteflag message creator class
This is a builder class to create a basic Whiteflag message. It contains the logic based on the Whiteflag specification to create a valid Whiteflag message object.
- Since:
- 1.0
- Whiteflag version:
- v1-draft.6
- Whiteflag standard x-reference:
- 4. Message Format
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal WfMessageCreator
Compiles a new Whiteflag base message object from field valuesfinal WfBasicMessage
create()
Creates the Whiteflag message basefinal WfMessageCreator
decode
(WfBinaryBuffer msgBuffer) Decodes an encoded Whiteflag message and creates a new Whiteflag base message objectfinal WfMessageCreator
deserialize
(String serializedMsg) Deserializes a serialized Whiteflag message and creates a new Whiteflag base message objectfinal WfMessageSegment
getUnencryptedHeader
(WfBinaryBuffer msgBuffer) Decodes an encoded Whiteflag message and creates a new Whiteflag base message objectfinal WfMessageCreator
Creates a new Whiteflag base message object from header and body mapsfinal WfMessageCreator
type
(WfMessageType messageType) Creates a new empty Whiteflag base message object of the specified type
-
Constructor Details
-
WfMessageCreator
public WfMessageCreator()Constructs a Whiteflag message creator
-
-
Method Details
-
create
Creates the Whiteflag message base- Returns:
- a new message base
-
type
Creates a new empty Whiteflag base message object of the specified type- Parameters:
messageType
- the type of the new message- Returns:
- this message creator
-
map
public final WfMessageCreator map(Map<String, String> headerValues, Map<String, throws WfCoreExceptionString> bodyValues) Creates a new Whiteflag base message object from header and body maps- Parameters:
headerValues
- a fieldname-to-value mapping of the message header fieldsbodyValues
- a fieldname-to-value mapping of the message body fields- Returns:
- this message creator
- Throws:
WfCoreException
- if the fieldname-to-value mapping is incorrect
-
deserialize
Deserializes a serialized Whiteflag message and creates a new Whiteflag base message object- Parameters:
serializedMsg
- the uncompressed serialized message- Returns:
- this message creator
- Throws:
WfCoreException
- if the provided values are invalid- Since:
- 1.1
-
decode
Decodes an encoded Whiteflag message and creates a new Whiteflag base message object- Parameters:
msgBuffer
- a buffer with the compressed binary encoded message- Returns:
- this message creator
- Throws:
WfCoreException
- if the encoded message is invalid- Since:
- 1.1
-
getUnencryptedHeader
Decodes an encoded Whiteflag message and creates a new Whiteflag base message object- Parameters:
msgBuffer
- a buffer with the compressed binary encoded message- Returns:
- the unencrypted message header
- Throws:
WfCoreException
- if the encoded message is invalid- Since:
- 1.1
-
compile
Compiles a new Whiteflag base message object from field values- Parameters:
fieldValues
- String array with the values for the message fields- Returns:
- this message creator
- Throws:
WfCoreException
- if the provided values are invalid
-