|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bloomberglp.blpapi.EventFormatter
public final class EventFormatter
EventFormatter is used to format publisher events or responses to certain
ProviderSession
requests.
Event
obtained from
Service.createPublishEvent()
or from Service.createResponseEvent(CorrelationID)
.
Once one or more Messages have been appended to the Event using the
EventFormatter the Event can be published using ProviderSession.publish(Event)
or sent back as a response
using ProviderSession.sendResponse(Event)
.
EventFormatter objects cannot be copied or assigned so as to ensure there is
no ambiguity about what happens if two EventFormatters are both formatting
the same Event.
An EventFormatter object supports writing once only to each field. It is an
error to call setElement() or pushElement() for the same name more than once
at a particular level of the schema when creating a message.
Constructor Summary | |
---|---|
EventFormatter(Event event)
Creates an EventFormatter to add messages to the specified
event. |
Method Summary | |
---|---|
void |
appendElement()
Append an empty complex element of the appropriate type to the element which represents an array of Element type. |
void |
appendMessage(Name messageType,
Topic topic)
Appends a (empty) message of the specified 'messageType' that will be published under the specified 'topic' to the event referenced by this EventFormatter . |
void |
appendMessage(Name messageType,
Topic topic,
java.lang.Integer sequenceNumber)
Appends a (empty) message of the specified 'messageType' that will be published under the specified 'topic' with the specified 'sequenceNumber' to the event referenced by this EventFormatter . |
void |
appendMessage(java.lang.String messageType,
Topic topic)
Appends a (empty) message of the specified 'messageType' that will be published under the specified 'topic' to the event referenced by this EventFormatter . |
void |
appendMessage(java.lang.String messageType,
Topic topic,
java.lang.Integer sequenceNumber)
Appends a (empty) message of the specified 'messageType' that will be published under the specified 'topic' with the specified 'sequenceNumber' to the event referenced by this EventFormatter . |
void |
appendRecapMessage(Topic topic,
CorrelationID cid)
Append a (empty) recap message that will be published under the specified 'topic' to the event referenced by this EventFormatter . |
void |
appendRecapMessage(Topic topic,
java.lang.Integer sequenceNumber,
CorrelationID cid)
Append a (empty) recap message that will be published under the specified 'topic' to the event referenced by this EventFormatter . |
void |
appendResponse(Name name)
Append a (empty) response message of the specified 'name' that will be sent in response to previously received operation request. |
void |
appendResponse(java.lang.String messageType)
Append a (empty) response message of the specified 'messageType' that will be sent in response to previously received operation request. |
void |
appendValue(boolean value)
Append the specified 'value' to the element which represents an array of boolean type. |
void |
appendValue(char value)
Append the specified 'value' to the element which represents an array of char type. |
void |
appendValue(Datetime value)
Append the specified 'value' to the element which represents an array of Datetime type. |
void |
appendValue(double value)
Append the specified 'value' to the element which represents an array of double type. |
void |
appendValue(float value)
Append the specified 'value' to the element which represents an array of float type. |
void |
appendValue(int value)
Append the specified 'value' to the element which represents an array of int type. |
void |
appendValue(long value)
Append the specified 'value' to the element which represents an array of long type. |
void |
appendValue(Name value)
Append the specified 'value' to the element which represents an array of Name type. |
void |
appendValue(java.lang.String value)
Append the specified 'value' to the element which represents an array of String type. |
void |
popElement()
Returns this formatter's context back to the location where it was before the most recent call to pushElement(java.lang.String) or {appendElement() . |
void |
pushElement(Name name)
Changes the level at which this EventFormatter is operating to
the specified element 'name'. |
void |
pushElement(java.lang.String name)
Changes the level at which this EventFormatter is operating to
the specified element 'name'. |
void |
setElement(Name name,
boolean value)
Sets the element with the specified name within the current
element to the specified value . |
void |
setElement(Name name,
char value)
Sets the element with the specified name within the current
element to the specified value . |
void |
setElement(Name name,
Datetime value)
Sets the element with the specified name within the current
element to the specified value . |
void |
setElement(Name name,
double value)
Sets the element with the specified name within the current
element to the specified value . |
void |
setElement(Name name,
float value)
Sets the element with the specified name within the current
element to the specified value . |
void |
setElement(Name name,
int value)
Sets the element with the specified name within the current
element to the specified value . |
void |
setElement(Name name,
long value)
Sets the element with the specified name within the current
element to the specified value . |
void |
setElement(Name name,
Name value)
Sets the element with the specified name within the current
element to the specified value . |
void |
setElement(Name name,
java.lang.String value)
Sets the element with the specified name within the current
element to the specified value . |
void |
setElement(java.lang.String name,
boolean value)
Sets the element with the specified name within the current
element to the specified value . |
void |
setElement(java.lang.String name,
char value)
Sets the element with the specified name within the current
element to the specified value . |
void |
setElement(java.lang.String name,
Datetime value)
Sets the element with the specified name within the current
element to the specified value . |
void |
setElement(java.lang.String name,
double value)
Sets the element with the specified name within the current
element to the specified value . |
void |
setElement(java.lang.String name,
float value)
Sets the element with the specified name within the current
element to the specified value . |
void |
setElement(java.lang.String name,
int value)
Sets the element with the specified name within the current
element to the specified value . |
void |
setElement(java.lang.String name,
long value)
Sets the element with the specified name within the current
element to the specified value . |
void |
setElement(java.lang.String name,
Name value)
Sets the element with the specified name within the current
element to the specified value . |
void |
setElement(java.lang.String name,
java.lang.String value)
Sets the element with the specified name within the current
element to the specified value . |
void |
setElementNull(Name name)
Creates a null element with the specified 'name'. |
void |
setElementNull(java.lang.String name)
Creates a null element with the specified 'name'. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EventFormatter(Event event)
EventFormatter
to add messages to the specified
event. The behavior is undefined if the specified event already has
another EventFormatter
attached.
event
- the event to be formattedMethod Detail |
---|
public void appendMessage(java.lang.String messageType, Topic topic)
EventFormatter
. After a message has been appended its elements
can be set using the various setElement()
methods.
messageType
- the name of the message type that needs to be addedtopic
- the corresponding topicpublic void appendMessage(java.lang.String messageType, Topic topic, java.lang.Integer sequenceNumber)
EventFormatter
. After a message has been appended its elements can be
set using the various setElement(java.lang.String, java.lang.String)
methods. The behavior is
undefined unless the 'sequenceNumber' is greater (unless the value
wrapped) than the last value used in any previous message on this
'topic'.
messageType
- the name of the message type that needs to be
addedtopic
- the corresponding topicsequenceNumber
- the sequence number for this messagepublic void appendMessage(Name messageType, Topic topic)
EventFormatter
. After a message has been appended its elements
can be set using the various setElement(java.lang.String, java.lang.String)
methods.
messageType
- the name of the message type that needs to be addedtopic
- the corresponding topicpublic void appendMessage(Name messageType, Topic topic, java.lang.Integer sequenceNumber)
EventFormatter
. After a message has been appended its elements can be
set using the various setElement(java.lang.String, java.lang.String)
methods. The behavior is
undefined unless the 'sequenceNumber' is greater (unless the value
wrapped) than the last value used in any previous message on this
'topic'.
messageType
- the name of the message type that needs to be
addedtopic
- the corresponding topicsequenceNumber
- the sequence number for this messagepublic void appendRecapMessage(Topic topic, CorrelationID cid)
EventFormatter
. Specify the optional 'cid' if this recap message is
added in response to a TopicRecap
message. After a message has
been appended its elements can be set using the various setElement(java.lang.String, java.lang.String)
methods. It is an error to append a recap message to
an admin event.
topic
- the corresponding topiccid
- the correlationId of the TopicRecap
message if
responding to a recap
request or null if this is a recap message for all subscriberspublic void appendRecapMessage(Topic topic, java.lang.Integer sequenceNumber, CorrelationID cid)
EventFormatter
. Specify the optional 'cid' if this recap message is
added in response to a TopicRecap
message. After a message has
been appended its elements can be set using the various setElement(java.lang.String, java.lang.String)
methods. It is an error to create append a recap message to
an admin event. The behavior is undefined unless the 'sequenceNumber' is
greater (unless the value wrapped) than the last value used in any
previous message on this 'topic'.
topic
- the corresponding topicsequenceNumber
- the sequence number for this messagecid
- the correlationId of the TopicRecap
message if responding to a
recap request or null if this is a recap message for all subscriberspublic void appendResponse(java.lang.String messageType)
setElement(java.lang.String, java.lang.String)
methods. Only one response can be appended to an
event.
messageType
- the name of the response type that needs to be addedpublic void appendResponse(Name name)
setElement(java.lang.String, java.lang.String)
methods. Only one response can be appended to an
event.
name
- the name of the response type that needs to be addedpublic void appendValue(boolean value)
boolean
type.
value
- the value to be addedpublic void appendValue(char value)
char
type.
value
- the value to be addedpublic void appendValue(int value)
int
type.
value
- the value to be addedpublic void appendValue(long value)
long
type.
value
- the value to be addedpublic void appendValue(float value)
float
type.
value
- the value to be addedpublic void appendValue(double value)
double
type.
value
- the value to be addedpublic void appendValue(Datetime value)
Datetime
type.
value
- the value to be addedpublic void appendValue(java.lang.String value)
String
type.
value
- the value to be addedpublic void appendValue(Name value)
Name
type.
value
- the value to be addedpublic void appendElement()
Element
type.
public void pushElement(java.lang.String name)
EventFormatter
is operating to
the specified element 'name'. After this returns the context of the
EventFormatter
is set to the element 'name' in the schema and
subsequent calls to setElement(java.lang.String, java.lang.String)
or pushElement(java.lang.String)
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 formatter to that element. Calling
appendElement()
again will create another entry.
name
- the name of sub-element
NotFoundException
- if the name does not identify a sub-element at
the current level of the schemapublic void pushElement(Name name)
EventFormatter
is operating to
the specified element 'name'. After this returns the context of the
EventFormatter
is set to the element 'name' in the schema and
subsequent calls to setElement(java.lang.String, java.lang.String)
or pushElement(java.lang.String)
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 formatter to that element. Calling
appendElement()
again will create another entry.
name
- the name of sub-element
NotFoundException
- if the name does not identify a sub-element at
the current level of the schemapublic void popElement()
pushElement(java.lang.String)
or {appendElement()
.
public void setElement(java.lang.String name, java.lang.String value)
name
within the current
element to the specified value
. The behavior of this function is
undefined if value
is null
. Note that this function is
not intended for publication of null values; use setElementNull(String)
instead.
name
- the name of subfieldvalue
- the value to be set
java.lang.UnsupportedOperationException
- if the current element is not a
sequence or choice
NotFoundException
- if the schema does not identify
a name
sub-element of the current sequence or choice element or
if the element identified by name
has already been set
InvalidConversionException
- if value
cannot be
converted to the type specified by the schema for the name
sub-element
java.lang.IllegalStateException
- if the operating stack is emptypublic void setElement(java.lang.String name, Name value)
name
within the current
element to the specified value
. The behavior of this function is
undefined if value
is null
. Note that this function is
not intended for publication of null values; use setElementNull(String)
instead.
name
- the name of subfieldvalue
- the value to be set
java.lang.UnsupportedOperationException
- if the current element is not a
sequence or choice
NotFoundException
- if the schema does not identify
a name
sub-element of the current sequence or choice element or
if the element identified by name
has already been set
InvalidConversionException
- if value
cannot be
converted to the type specified by the schema for the name
sub-element
java.lang.IllegalStateException
- if the operating stack is emptypublic void setElement(java.lang.String name, boolean value)
name
within the current
element to the specified value
.
name
- the name of subfieldvalue
- the value to be set
java.lang.UnsupportedOperationException
- if the current element is not a
sequence or choice
NotFoundException
- if the schema does not identify
a name
sub-element of the current sequence or choice element or
if the element identified by name
has already been set
InvalidConversionException
- if value
cannot be
converted to the type specified by the schema for the name
sub-element
java.lang.IllegalStateException
- if the operating stack is emptypublic void setElement(java.lang.String name, char value)
name
within the current
element to the specified value
.
name
- the name of subfieldvalue
- the value to be set
java.lang.UnsupportedOperationException
- if the current element is not a
sequence or choice
NotFoundException
- if the schema does not identify
a name
sub-element of the current sequence or choice element or
if the element identified by name
has already been set
InvalidConversionException
- if value
cannot be
converted to the type specified by the schema for the name
sub-element
java.lang.IllegalStateException
- if the operating stack is emptypublic void setElement(java.lang.String name, int value)
name
within the current
element to the specified value
.
name
- the name of subfieldvalue
- the value to be set
java.lang.UnsupportedOperationException
- if the current element is not a
sequence or choice
NotFoundException
- if the schema does not identify
a name
sub-element of the current sequence or choice element or
if the element identified by name
has already been set
InvalidConversionException
- if value
cannot be
converted to the type specified by the schema for the name
sub-element
java.lang.IllegalStateException
- if the operating stack is emptypublic void setElement(java.lang.String name, long value)
name
within the current
element to the specified value
.
name
- the name of subfieldvalue
- the value to be set
java.lang.UnsupportedOperationException
- if the current element is not a
sequence or choice
NotFoundException
- if the schema does not identify
a name
sub-element of the current sequence or choice element or
if the element identified by name
has already been set
InvalidConversionException
- if value
cannot be
converted to the type specified by the schema for the name
sub-element
java.lang.IllegalStateException
- if the operating stack is emptypublic void setElement(java.lang.String name, float value)
name
within the current
element to the specified value
.
name
- the name of subfieldvalue
- the value to be set
java.lang.UnsupportedOperationException
- if the current element is not a
sequence or choice
NotFoundException
- if the schema does not identify
a name
sub-element of the current sequence or choice element or
if the element identified by name
has already been set
InvalidConversionException
- if value
cannot be
converted to the type specified by the schema for the name
sub-element
java.lang.IllegalStateException
- if the operating stack is emptypublic void setElement(java.lang.String name, double value)
name
within the current
element to the specified value
.
name
- the name of subfieldvalue
- the value to be set
java.lang.UnsupportedOperationException
- if the current element is not a
sequence or choice
NotFoundException
- if the schema does not identify
a name
sub-element of the current sequence or choice element or
if the element identified by name
has already been set
InvalidConversionException
- if value
cannot be
converted to the type specified by the schema for the name
sub-element
java.lang.IllegalStateException
- if the operating stack is emptypublic void setElement(Name name, java.lang.String value)
name
within the current
element to the specified value
. The behavior of this function is
undefined if value
is null
. Note that this function is
not intended for publication of null values; use setElementNull(Name)
instead.
name
- the name of subfieldvalue
- the value to be set
java.lang.UnsupportedOperationException
- if the current element is not a
sequence or choice
NotFoundException
- if the schema does not identify
a name
sub-element of the current sequence or choice element or
if the element identified by name
has already been set
InvalidConversionException
- if value
cannot be
converted to the type
specified by the schema for the name
sub-element
java.lang.IllegalStateException
- if the operating stack is emptypublic void setElement(Name name, Name value)
name
within the current
element to the specified value
. The behavior of this function is
undefined if value
is null
. Note that this function is
not intended for publication of null values; use setElementNull(Name)
instead.
name
- the name of subfieldvalue
- the value to be set
java.lang.UnsupportedOperationException
- if the current element is not a
sequence or choice
NotFoundException
- if the schema does not identify
a name
sub-element of the current sequence or choice element or
if the element identified by name
has already been set
InvalidConversionException
- if value
cannot be
converted to the type specified by the schema for the name
sub-element
java.lang.IllegalStateException
- if the operating stack is emptypublic void setElement(Name name, boolean value)
name
within the current
element to the specified value
.
name
- the name of subfieldvalue
- the value to be set
java.lang.UnsupportedOperationException
- if the current element is not a
sequence or choice
NotFoundException
- if the schema does not identify
a name
sub-element of the current sequence or choice element or
if the element identified by name
has already been set
InvalidConversionException
- if value
cannot be
converted to the type specified by the schema for the name
sub-element
java.lang.IllegalStateException
- if the operating stack is emptypublic void setElement(Name name, char value)
name
within the current
element to the specified value
.
name
- the name of subfieldvalue
- the value to be set
java.lang.UnsupportedOperationException
- if the current element is not a
sequence or choice
NotFoundException
- if the schema does not identify
a name
sub-element of the current sequence or choice element or
if the element identified by name
has already been set
InvalidConversionException
- if value
cannot be
converted to the type specified by the schema for the name
sub-element
java.lang.IllegalStateException
- if the operating stack is emptypublic void setElement(Name name, int value)
name
within the current
element to the specified value
.
name
- the name of subfieldvalue
- the value to be set
java.lang.UnsupportedOperationException
- if the current element is not a
sequence or choice
NotFoundException
- if the schema does not identify
a name
sub-element of the current sequence or choice element or
if the element identified by name
has already been set
InvalidConversionException
- if value
cannot be
converted to the type specified by the schema for the name
sub-element
java.lang.IllegalStateException
- if the operating stack is emptypublic void setElement(Name name, long value)
name
within the current
element to the specified value
.
name
- the name of subfieldvalue
- the value to be set
java.lang.UnsupportedOperationException
- if the current element is not a
sequence or choice
NotFoundException
- if the schema does not identify
a name
sub-element of the current sequence or choice element or
if the element identified by name
has already been set
InvalidConversionException
- if value
cannot be
converted to the type specified by the schema for the name
sub-element
java.lang.IllegalStateException
- if the operating stack is emptypublic void setElement(Name name, float value)
name
within the current
element to the specified value
.
name
- the name of subfieldvalue
- the value to be set
java.lang.UnsupportedOperationException
- if the current element is not a
sequence or choice
NotFoundException
- if the schema does not identify
a name
sub-element of the current sequence or choice element or
if the element identified by name
has already been set
InvalidConversionException
- if value
cannot be
converted to the type specified by the schema for the name
sub-element
java.lang.IllegalStateException
- if the operating stack is emptypublic void setElement(Name name, double value)
name
within the current
element to the specified value
.
name
- the name of subfieldvalue
- the value to be set
java.lang.UnsupportedOperationException
- if the current element is not a
sequence or choice
NotFoundException
- if the schema does not identify
a name
sub-element of the current sequence or choice element or
if the element identified by name
has already been set
InvalidConversionException
- if value
cannot be
converted to the type specified by the schema for the name
sub-element
java.lang.IllegalStateException
- if the operating stack is emptypublic void setElement(java.lang.String name, Datetime value)
name
within the current
element to the specified value
. The behavior of this function is
undefined if value
is null
. Note that this function is
not intended for publication of null values; use setElementNull(String)
instead.
name
- the name of subfieldvalue
- the value to be set
java.lang.UnsupportedOperationException
- if the current element is not a
sequence or choice
NotFoundException
- if the schema does not identify
a name
sub-element of the current sequence or choice element or
if the element identified by name
has already been set
InvalidConversionException
- if value
cannot be
converted to the type specified by the schema for the name
sub-element
java.lang.IllegalStateException
- if the operating stack is emptypublic void setElement(Name name, Datetime value)
name
within the current
element to the specified value
. The behavior of this function is
undefined if value
is null
. Note that this function is
not intended for publication of null values; use setElementNull(Name)
instead.
name
- the name of subfieldvalue
- the value to be set
java.lang.UnsupportedOperationException
- if the current element is not a
sequence or choice
NotFoundException
- if the schema does not identify
a name
sub-element of the current sequence or choice element or
if the element identified by name
has already been set
InvalidConversionException
- if value
cannot be
converted to the type specified by the schema for the name
sub-element
java.lang.IllegalStateException
- if the operating stack is emptypublic void setElementNull(java.lang.String name)
name
- the name of subfield to be nulled
java.lang.UnsupportedOperationException
- if the current element is not a
sequence or choice
NotFoundException
- if the schema does not identify
a name
sub-element of the current sequence or choice element or
if the element identified by name
has already been set
InvalidConversionException
- if value
cannot be
converted to the type specified by the schema for the name
sub-element
java.lang.IllegalStateException
- if the operating stack is emptypublic void setElementNull(Name name)
name
- the name of subfield to be nulled
java.lang.UnsupportedOperationException
- if the current element is not a
sequence or choice
NotFoundException
- if the schema does not identify
a name
sub-element of the current sequence or choice element or
if the element identified by name
has already been set
InvalidConversionException
- if value
cannot be
converted to the type specified by the schema for the name
sub-element
java.lang.IllegalStateException
- if the operating stack is empty
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |