public interface MessageFormatter
MessageFormatter is used to populate/format a message. It supports
writing once only to each field. Attempting to set an already set element
will fail.
Note that the behavior is undefined if
formatMessageXml(java.lang.String) is
further formatted.set method or an append
method is further formatted using formatMessageXml(java.lang.String).
| Modifier and Type | Method and Description |
|---|---|
void |
appendElement()
Creates an array element and appends it to the element on which this
MessageFormatter is operating on. |
void |
appendValue(boolean value)
Appends the specified
value to the element on which this
MessageFormatter is operating. |
void |
appendValue(char value)
Appends the specified
value to the element on which this
MessageFormatter is operating. |
void |
appendValue(Datetime value)
Appends the specified
value to the element on which this
MessageFormatter is operating. |
void |
appendValue(double value)
Appends the specified
value to the element on which this
MessageFormatter is operating. |
void |
appendValue(float value)
Appends the specified
value to the element on which this
MessageFormatter is operating. |
void |
appendValue(int value)
Appends the specified
value to the element on which this
MessageFormatter is operating. |
void |
appendValue(long value)
Appends the specified
value to the element on which this
MessageFormatter is operating. |
void |
appendValue(Name value)
Appends the specified
value to the element on which this
MessageFormatter is operating. |
void |
appendValue(String value)
Appends the specified
value to the element on which this
MessageFormatter is operating. |
void |
formatMessageXml(String message)
Formats the message from its
XML representation. |
void |
popElement()
Undoes the most recent call to
pushElement(com.bloomberglp.blpapi.Name) on this
MessageFormatter and returns the context of the
MessageFormatter to where it was before the call to
pushElement(com.bloomberglp.blpapi.Name). |
void |
pushElement(Name name)
Changes the level at which this
MessageFormatter is operating to
the specified element name. |
void |
setElement(Name name,
boolean value)
Sets the element with the specified
name to the specified
value in the current message referenced by this
MessageFormatter. |
void |
setElement(Name name,
char value)
Sets the element with the specified
name to the specified
value in the current message referenced by this
MessageFormatter. |
void |
setElement(Name name,
Datetime value)
Sets the element with the specified
name to the specified
value in the current message referenced by this
MessageFormatter. |
void |
setElement(Name name,
double value)
Sets the element with the specified
name to the specified
value in the current message referenced by this
MessageFormatter. |
void |
setElement(Name name,
float value)
Sets the element with the specified
name to the specified
value in the current message referenced by this
MessageFormatter. |
void |
setElement(Name name,
int value)
Sets the element with the specified
name to the specified
value in the current message referenced by this
MessageFormatter. |
void |
setElement(Name name,
long value)
Sets the element with the specified
name to the specified
value in the current message referenced by this
MessageFormatter. |
void |
setElement(Name name,
Name value)
Sets the element with the specified
name to the specified
value in the current message referenced by this
MessageFormatter. |
void |
setElement(Name name,
String value)
Sets the element with the specified
name to the specified
value in the current message referenced by this
MessageFormatter. |
void |
setElementNull(Name name)
Creates a null element with the specified
name. |
void setElement(Name name, boolean value)
name to the specified
value in the current message referenced by this
MessageFormatter. If the name is invalid for the current
message or if the element identified by name has already been
set, an exception is thrown.name - name of the element.value - the value to be set.IllegalArgumentException - if name is null.void setElement(Name name, char value)
name to the specified
value in the current message referenced by this
MessageFormatter. If the name is invalid for the current
message or if the element identified by name has already been
set, an exception is thrown.name - name of the element.value - the value to be set.IllegalArgumentException - if name is null.void setElement(Name name, int value)
name to the specified
value in the current message referenced by this
MessageFormatter. If the name is invalid for the current
message or if the element identified by name has already been
set, an exception is thrown.name - name of the element.value - the value to be set.IllegalArgumentException - if name is null.void setElement(Name name, long value)
name to the specified
value in the current message referenced by this
MessageFormatter. If the name is invalid for the current
message or if the element identified by name has already been
set, an exception is thrown.name - name of the element.value - the value to be set.IllegalArgumentException - if name is null.void setElement(Name name, float value)
name to the specified
value in the current message referenced by this
MessageFormatter. If the name is invalid for the current
message or if the element identified by name has already been
set, an exception is thrown.name - name of the element.value - the value to be set.IllegalArgumentException - if name is null.void setElement(Name name, double value)
name to the specified
value in the current message referenced by this
MessageFormatter. If the name is invalid for the current
message or if the element identified by name has already been
set, an exception is thrown.name - name of the element.value - the value to be set.IllegalArgumentException - if name is null.void setElement(Name name, Datetime value)
name to the specified
value in the current message referenced by this
MessageFormatter. If the name is invalid for the current
message or if the element identified by name has already been
set, an exception is thrown.name - name of the element.value - the value to be set.IllegalArgumentException - if name is null or value is null.void setElement(Name name, String value)
name to the specified
value in the current message referenced by this
MessageFormatter. If the name is invalid for the current
message, or if the element identified by name has already been
set, an exception is thrown.
The behavior is undefined unless value is not null.
Clients wishing to format null values (e.g. for the purpose of cache
management) should not use this function; use
setElementNull(com.bloomberglp.blpapi.Name) instead.
name - name of the element.value - the value to be set.IllegalArgumentException - if name is null or value is null.void setElement(Name name, Name value)
name to the specified
value in the current message referenced by this
MessageFormatter. If the name is invalid for the current
message or if the element identified by name has already been
set, an exception is thrown.name - name of the element.value - the value to be set.IllegalArgumentException - if name is null or value is null.void setElementNull(Name name)
name. Note that
whether or not fields containing null values are published to
subscribers is dependent upon details of the service and the schema
configuration. If the name is invalid for the current message
or if the element identified by name has already been set, an
exception is thrown.name - name of the element.IllegalArgumentException - if name is null.void pushElement(Name name)
MessageFormatter is operating to
the specified element name. The element name must
identify either a choice, a sequence or an array at the current level of
the schema or the behavior is undefined. If the name is invalid
for the current message or if the element identified by name has
already been set, an exception is thrown.
After this returns, the context of the MessageFormatter is set
to the element name in the schema and any calls to
setElement(com.bloomberglp.blpapi.Name, boolean) or pushElement(com.bloomberglp.blpapi.Name) are applied at that level.
If name represents an array of scalars then appendValue(boolean)
must be used to add values.
If name represents an array of complex types then
appendElement() creates the first entry and sets the context of
the MessageFormatter to that element. Calling
appendElement() again will create another entry.
name - name of the element.IllegalArgumentException - if name is null.void popElement()
pushElement(com.bloomberglp.blpapi.Name) on this
MessageFormatter and returns the context of the
MessageFormatter to where it was before the call to
pushElement(com.bloomberglp.blpapi.Name). Once popElement() has been called it is
invalid to attempt to re-visit the same context.void appendValue(boolean value)
value to the element on which this
MessageFormatter is operating. Throws an exception if the schema
of the message is flat or the current element to which value is
appended is not an array.value - the value to be appended to this array.void appendValue(char value)
value to the element on which this
MessageFormatter is operating. Throws an exception if the schema
of the message is flat or the current element to which value is
appended is not an array.value - the value to be appended to this array.void appendValue(int value)
value to the element on which this
MessageFormatter is operating. Throws an exception if the schema
of the message is flat or the current element to which value is
appended is not an array.value - the value to be appended to this array.void appendValue(long value)
value to the element on which this
MessageFormatter is operating. Throws an exception if the schema
of the message is flat or the current element to which value is
appended is not an array.value - the value to be appended to this array.void appendValue(float value)
value to the element on which this
MessageFormatter is operating. Throws an exception if the schema
of the message is flat or the current element to which value is
appended is not an array.value - the value to be appended to this array.void appendValue(double value)
value to the element on which this
MessageFormatter is operating. Throws an exception if the schema
of the message is flat or the current element to which value is
appended is not an array.value - the value to be appended to this array.void appendValue(Datetime value)
value to the element on which this
MessageFormatter is operating. Throws an exception if the schema
of the message is flat or the current element to which value is
appended is not an array.value - the value to be appended to this array.IllegalArgumentException - if value is null.void appendValue(String value)
value to the element on which this
MessageFormatter is operating. Throws an exception if the schema
of the message is flat or the current element to which value is
appended is not an array.value - the value to be appended to this array.IllegalArgumentException - if value is null.void appendValue(Name value)
value to the element on which this
MessageFormatter is operating. Throws an exception if the schema
of the message is flat or the current element to which value is
appended is not an array.value - the value to be appended to this array.IllegalArgumentException - if value is null.void appendElement()
MessageFormatter is operating on. Throws an exception if the
schema of the message is flat.void formatMessageXml(String message)
XML representation. An exception is
thrown if the method fails to format the message. The behavior is
undefined if further formatting is done using this
MessageFormatter.message - XML representation of the message.IllegalArgumentException - if message is null.Copyright © 2021 Bloomberg L.P.. All rights reserved.