|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bloomberglp.blpapi.Element
public abstract class Element
Elements are used to represent all data sent to/received from API services.
Using "Element" objects
An element is a variant type. That is they can represent any of the data types supported by the blpapi. Elements can represent simple scalar values like (float, string), arrays of simple types, complex values (sequences/choices), and arrays of complex values.
Accessing Elements
Elements are used when accessing messages received from the API, and when preparing requests for API services. There are two classes of accessor/manipulators that are used to access/manipulate elements. When accessing simple values and arrays, the "getValueAsX" family of functions are used where 'X' is the target data type(e.g., "getValueAsInt32"). For simplicity, all "getValueAsX" functions can optionally be supplied with an index parameter to access elements of an array. For scalar elements, index should not be supplied, or zero should be supplied. The following are examples of accessing simple and array elements.
This example shows how to access the value of a scalar element as an integer number. Then goes on to show how to access the same element as a String
Element e;
...
int x = e.getValueAsIn32();
System.out.println(e.getValueAsString());
(or)
System.out.println(e.getValueAsString(0));
The following example shows how to access array elements
int count = e.numValues();
for (int i = 0; i < count; ++i) {
System.out.println(e.getValueAsString(i));
}
Use numValues() to determine the number of values available. For scalar values, it will return either 0 or 1. For arrays it will return the actual number of values in the array.
Complex elements contain named sub-elements. Sub-elements are accessed using
the "getElement" and "getElementAsX" accessor functions. To demonstrate, the
following example, shows how to access the "city" sub-element of an
"address" element:
Element address;
...
address.getElement("city");
The following example retrieves the value of the "city" sub-element as a
string value.
address.getElementAsString("city");
To determine the number of available sub elements in a given element, the "numElements" accessor can be used. To retrieve the Nth available sub-element of a complex element, the "getElement(int)" accessor can be used. For example:
int numElements = address.numElements();
for (int i = 0; i < numElements; ++i) {
Element e = address.getElement(i);
System.out.println(e.name() + " = " + e.getValueAsString());
}
Manipulating Elements
Elements are also used to submit input for API services (e.g., preparing a reference data request). Just as when accessing element values, there are two types of manipulators used to set elements. To set the value of simple elements, and arrays of simple elements, the "setValue", and "appendValue" manipulator are used. For example
Request request;
...
Element security = request.getElement("security");
security.setValue("IBM UN Equity");
Element fields = request.getElement("fields");
fields.appendValue("DS003");
fields.appendValue("PX_LAST");
To directly set named sub-elements, use the "setElement" manipulator:
request.setElement("security", "IBM UN Equity");
Methods which specify a Element name come in two forms. One which takes a
Name
as a parameter and one which takes a String. The form which
takes Name is more efficient. However, it requires the Name to have been
created in the global name table.
Type Conversions
The API will convert data types as long as there is no loss of precision
involved. So
- A BOOL can be returned as bool, char, Int32, Int64, Float32, Float64,
String (the string will be "true" or "false")
- A BOOL can be set from bool, String (if it has a value of "y", "n", "yes",
"no", "true" or "false")
- A CHAR can be returned as char, Int32, Int64, Float32, Float64, String
- A CHAR can be set from char
- An INT32 can be returned as Int32, Int64, Float64, String
- An INT32 can be set from char, Int32
- An INT64 can be returned as Int64, String
- An INT64 can be set from char, Int32, Int64
- A FLOAT32 can be returned as Float32, Float64, String
- A FLOAT32 can be set from char, Float32
- A FLOAT64 can be returned as Float64, String
- A FLOAT64 can be set from char, Float32, Float64
Constructor Summary | |
---|---|
Element()
|
Method Summary | |
---|---|
abstract Element |
appendElement()
If this Element is an array of Sequence or Choice Elements append a default initialized element to this element and return the appended element |
abstract void |
appendValue(boolean value)
Append the specified value to this array element |
abstract void |
appendValue(byte[] value)
Append the specified value to this array element |
abstract void |
appendValue(char value)
Append the specified value to this array element |
abstract void |
appendValue(Constant value)
Append the specified value to this array element |
abstract void |
appendValue(Datetime value)
Append the specified value to this array element |
abstract void |
appendValue(double value)
Append the specified value to this array element |
abstract void |
appendValue(float value)
Append the specified value to this array element |
abstract void |
appendValue(int value)
Append the specified value to this array element |
abstract void |
appendValue(long value)
Append the specified value to this array element |
abstract void |
appendValue(Name value)
Append the specified Constant value to this array element |
abstract void |
appendValue(java.lang.String value)
Append the specified value to this array element |
abstract java.lang.Object |
clone()
|
abstract Schema.Datatype |
datatype()
Returns the Datatype of this Element |
abstract SchemaElementDefinition |
elementDefinition()
Return a reference to the read-only element definition object that defines the properties of this elements value. |
ElementIterator |
elementIterator()
Return an iterator for iterating over elements of this Sequence or Choice |
abstract Constant |
findConstant(ConstantsList constantsList)
|
abstract Constant |
findConstant(ConstantsList constantsList,
int index)
|
abstract Element |
getChoice()
|
abstract Element |
getElement(int position)
Return the element at the specified zero based position. |
abstract Element |
getElement(Name name)
Return the named sub-element, creating it if it doesn't exist if this element is modifiable |
abstract Element |
getElement(java.lang.String name)
Return the named sub-element, creating it if it doesn't exist if this element is modifiable |
abstract boolean |
getElementAsBool(Name name)
Returns the value of the named sub-element as a boolean |
abstract boolean |
getElementAsBool(java.lang.String name)
Returns the value of the named sub-element as a boolean |
abstract byte[] |
getElementAsBytes(Name name)
Returns the value of the named sub-element as a byte array |
abstract byte[] |
getElementAsBytes(java.lang.String name)
Returns the value of the named sub-element as a byte array |
abstract char |
getElementAsChar(Name name)
Returns the value of the named sub-element as a char |
abstract char |
getElementAsChar(java.lang.String name)
Returns the value of the named sub-element as a char |
abstract Datetime |
getElementAsDate(Name name)
Returns the value of the named sub-element as a Date |
abstract Datetime |
getElementAsDate(java.lang.String name)
Returns the value of the named sub-element as a Date |
abstract Datetime |
getElementAsDatetime(Name name)
Returns the value of the named sub-element as a Datetime |
abstract Datetime |
getElementAsDatetime(java.lang.String name)
Returns the value of the named sub-element as a Datetime |
abstract float |
getElementAsFloat32(Name name)
Returns the value of the named sub-element as a float |
abstract float |
getElementAsFloat32(java.lang.String name)
Returns the value of the named sub-element as a float |
abstract double |
getElementAsFloat64(Name name)
Returns the value of the named sub-element as a double |
abstract double |
getElementAsFloat64(java.lang.String name)
Returns the value of the named sub-element as a double |
abstract int |
getElementAsInt32(Name name)
Returns the value of the named sub-element as a int |
abstract int |
getElementAsInt32(java.lang.String name)
Returns the value of the named sub-element as a int |
abstract long |
getElementAsInt64(Name name)
Returns the value of the named sub-element as a long |
abstract long |
getElementAsInt64(java.lang.String name)
Returns the value of the named sub-element as a int |
abstract Name |
getElementAsName(Name name)
Returns the value of the named sub-element as the name of a constant. |
abstract Name |
getElementAsName(java.lang.String name)
Returns the value of the named sub-element as the name of a constant. |
abstract java.lang.String |
getElementAsString(Name name)
Returns the value of the named sub-element as a String |
abstract java.lang.String |
getElementAsString(java.lang.String name)
Returns the value of the named sub-element as a String |
abstract Datetime |
getElementAsTime(Name name)
Returns the value of the named sub-element as a Time |
abstract Datetime |
getElementAsTime(java.lang.String name)
Returns the value of the named sub-element as a Time |
abstract boolean |
getValueAsBool()
Returns the value of this element as a boolean |
abstract boolean |
getValueAsBool(int index)
Returns the value of the element at the specified index as a boolean |
abstract byte[] |
getValueAsBytes()
Returns the value of this element as a byte array |
abstract byte[] |
getValueAsBytes(int index)
Returns the value of the element at the specified index as a byte array |
abstract char |
getValueAsChar()
Returns the value of this element as a char |
abstract char |
getValueAsChar(int index)
Returns the value of the element at the specified index as a char |
abstract Datetime |
getValueAsDate()
Returns the value of this element as a Date |
abstract Datetime |
getValueAsDate(int index)
Returns the value of the element at the specified index as a Date |
abstract Datetime |
getValueAsDatetime()
Returns the value of this element as a Datetime |
abstract Datetime |
getValueAsDatetime(int index)
Returns the value of the element at the specified index as a Datetime |
abstract Element |
getValueAsElement()
Returns the value of this element as an Element |
abstract Element |
getValueAsElement(int index)
Returns the value at the specified index in this element as an Element |
abstract Constant |
getValueAsEnumeration()
Returns the value of this element as a Enumeration constant |
abstract Constant |
getValueAsEnumeration(int index)
Returns the value of the element at the specified index as a Enumeration constant |
abstract float |
getValueAsFloat32()
Returns the value of this element as a float |
abstract float |
getValueAsFloat32(int index)
Returns the value of the element at the specified index as a float |
abstract double |
getValueAsFloat64()
Returns the value of this element as a double |
abstract double |
getValueAsFloat64(int index)
Returns the value of the element at the specified index as a double |
abstract int |
getValueAsInt32()
Returns the value of this element as a int |
abstract int |
getValueAsInt32(int index)
Returns the value of the element at the specified index as a int |
abstract long |
getValueAsInt64()
Returns the value of this element as a long |
abstract long |
getValueAsInt64(int index)
Returns the value of the element at the specified index as a long |
abstract Name |
getValueAsName()
Returns the value of this element as a Enumeration constant |
abstract Name |
getValueAsName(int index)
Returns the value of the element at the specified index as a Enumeration constant |
abstract java.lang.String |
getValueAsString()
Returns the value of this element as a String |
abstract java.lang.String |
getValueAsString(int index)
Returns the value of the element at the specified index as a String |
abstract Datetime |
getValueAsTime()
Returns the value of this element as a Time |
abstract Datetime |
getValueAsTime(int index)
Returns the value of the element at the specified index as a Time |
abstract boolean |
hasElement(Name name)
Returns true if this element contains an element with the specified name Same as calling hasElement(name, false) |
abstract boolean |
hasElement(Name name,
boolean excludeNullElements)
Returns true if this element contains an element with the specified name |
abstract boolean |
hasElement(java.lang.String name)
Returns true if this element contains an element with the specified name Same as calling hasElement(name, false |
abstract boolean |
hasElement(java.lang.String name,
boolean excludeNullElements)
Returns true if this element contains an element with the specified name |
abstract boolean |
isArray()
Returns true if this element is an array |
abstract boolean |
isComplexType()
Returns if this element is a complex type |
abstract boolean |
isEqualTo(Constant constant)
|
abstract boolean |
isEqualTo(Constant constant,
int index)
Return true if the value at the specified index of this element is equal to the specified constant |
abstract boolean |
isNull()
Returns true if this element is null. |
abstract boolean |
isNullValue(int position)
Returns true if the element at the specified position in a Sequence or choice element is null. |
abstract boolean |
isReadOnly()
Returns true if this element cannot be modified |
abstract Name |
name()
Return the name of this Element |
abstract int |
numElements()
Return the number of elements this element contains |
abstract int |
numValues()
Return the number of values this element contains |
abstract void |
print(java.io.OutputStream output)
Prints the contents of this element to the specified OutputStream. |
abstract void |
print(java.io.Writer writer)
Prints the contents of this element to the specified Writer. |
abstract Element |
setChoice(Name name)
Set the named sub-element as the choice's selection |
abstract Element |
setChoice(java.lang.String name)
Set the named sub-element as the choice's selection |
abstract void |
setElement(Name name,
boolean value)
Set the named sub-element to the specified value |
abstract void |
setElement(Name name,
byte[] value)
Set the named sub-element to the specified value |
abstract void |
setElement(Name name,
char value)
Set the named sub-element to the specified value |
abstract void |
setElement(Name name,
Constant value)
Set the named sub-element to the specified value |
abstract void |
setElement(Name name,
Datetime value)
Set the named sub-element to the specified value |
abstract void |
setElement(Name name,
double value)
Set the named sub-element to the specified value |
abstract void |
setElement(Name name,
float value)
Set the named sub-element to the specified value |
abstract void |
setElement(Name name,
int value)
Set the named sub-element to the specified value |
abstract void |
setElement(Name name,
long value)
Set the named sub-element to the specified value |
abstract void |
setElement(Name name,
Name value)
Set the named sub-element to the specified value |
abstract void |
setElement(Name name,
java.lang.String value)
Set the named sub-element to the specified value |
abstract void |
setElement(java.lang.String name,
boolean value)
Set the named sub-element to the specified value |
abstract void |
setElement(java.lang.String name,
byte[] value)
Set the named sub-element to the specified value |
abstract void |
setElement(java.lang.String name,
char value)
Set the named sub-element to the specified value |
abstract void |
setElement(java.lang.String name,
Constant value)
Set the named sub-element to the specified value |
abstract void |
setElement(java.lang.String name,
Datetime value)
Set the named sub-element to the specified value |
abstract void |
setElement(java.lang.String name,
double value)
Set the named sub-element to the specified value |
abstract void |
setElement(java.lang.String name,
float value)
Set the named sub-element to the specified value |
abstract void |
setElement(java.lang.String name,
int value)
Set the named sub-element to the specified value |
abstract void |
setElement(java.lang.String name,
long value)
Set the named sub-element to the specified value |
abstract void |
setElement(java.lang.String name,
Name value)
Set the named sub-element to the specified value |
abstract void |
setElement(java.lang.String name,
java.lang.String value)
Set the named sub-element to the specified value |
abstract void |
setValue(boolean value)
Set the value of this element to the specified value. |
abstract void |
setValue(boolean value,
int index)
Set the value of the element at the specified index to the specified value |
abstract void |
setValue(byte[] value)
Set the value of this element to the specified value. |
abstract void |
setValue(byte[] value,
int index)
Set the value of this element to the specified value |
abstract void |
setValue(char value)
Set the value of this element to the specified value. |
abstract void |
setValue(char value,
int index)
Set the value of this element to the specified value |
abstract void |
setValue(Constant constant)
Set the value of this element to the specified value. |
abstract void |
setValue(Constant constant,
int index)
Set the value of this element to the specified value |
abstract void |
setValue(Datetime value)
Set the value of this element to the specified value. |
abstract void |
setValue(Datetime value,
int index)
Set the value of this element to the specified value |
abstract void |
setValue(double value)
Set the value of this element to the specified value. |
abstract void |
setValue(double value,
int index)
Set the value of this element to the specified value |
abstract void |
setValue(float value)
Set the value of this element to the specified value. |
abstract void |
setValue(float value,
int index)
Set the value of this element to the specified value |
abstract void |
setValue(int value)
Set the value of this element to the specified value. |
abstract void |
setValue(int value,
int index)
Set the value of this element to the specified value |
abstract void |
setValue(long value)
Set the value of this element to the specified value. |
abstract void |
setValue(long value,
int index)
Set the value of this element to the specified value |
abstract void |
setValue(Name constant)
Set the value of this element to the specified value. |
abstract void |
setValue(Name constant,
int index)
Set the value of this element to the specified constant value |
abstract void |
setValue(java.lang.String value)
Set the value of this element to the specified value. |
abstract void |
setValue(java.lang.String value,
int index)
Set the value of this element to the specified value |
abstract java.lang.String |
toString()
Returns the contents of this element as a String |
abstract SchemaTypeDefinition |
typeDefinition()
Returns the SchemaTypeDefinition for this element. |
abstract boolean |
valueIsNull(int position)
Deprecated. As of 3.2.1, replaced by isNullValue(int) |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Element()
Method Detail |
---|
public abstract Name name()
If this Element is part of a sequence or choice Element then this returns the Name of this Element within the sequence or choice Element that owns it. If this Element is not part of a sequence Element (that is it is an entire Request or Message) then the Name of the Request or Message is returned
public abstract Schema.Datatype datatype()
Equivalent to calling elementDefinition()
.
typeDefinition()
.
datatype()
public abstract boolean isArray()
Returns true if
elementDefinition().maxValues() > 1 or
if elementDefinition().maxValues() == SchemaElementDefinition.UNBOUNDED
public abstract boolean isComplexType()
returns true if datatype()
== Schema.Datatype.SEQUENCE
public abstract boolean isReadOnly()
Please note that calling setters on a readonly element will cause an UnsupportedOperationException to be thrown
public abstract SchemaElementDefinition elementDefinition()
public abstract SchemaTypeDefinition typeDefinition()
This is equivalent to calling
elementDefinition()
.datatype()
public abstract int numValues()
The return value from this function is always >= 0. For scalar elements this function returns 1 or 0. For arrays this function returns the actual number of values in the array.
public abstract int numElements()
Elements for which isComplexType()
is false always return 0
Choice elements always return 1.
Sequence elements return the actual number of elements they contain.
public abstract boolean isNull()
For arrays this function always returns false else this is
same as testing == 0
public abstract boolean valueIsNull(int position)
isNullValue(int)
position
- identifies the position of the element that is being
tested
NotFoundException
- if position >= numElements()
public abstract boolean isNullValue(int position)
position
- identifies the position of the element that is being
tested
NotFoundException
- if position >= numElements()
public abstract boolean isEqualTo(Constant constant)
public abstract boolean isEqualTo(Constant constant, int index)
constant
- the Constant which is being comparedindex
- the Index of the value in this element that the constant is
being compared to.
java.lang.IndexOutOfBoundsException
- if
index >= numValues()
public abstract Constant findConstant(ConstantsList constantsList)
constantsList
-
java.lang.IndexOutOfBoundsException
NotFoundException
public abstract Constant findConstant(ConstantsList constantsList, int index)
constantsList
- index
-
NotFoundException
java.lang.IndexOutOfBoundsException
public abstract Element getValueAsElement()
Same as calling getValueAsElement(0)
InvalidConversionException
- if the value of this element cannot
be converted to an Element
java.lang.IndexOutOfBoundsException
- if
numValues()
== 0
getValueAsElement(int)
public abstract Element getValueAsElement(int index)
Applicable only for an array of Sequence or Choice elements.
index
- of the Element that is requested
java.lang.IndexOutOfBoundsException
- if the specified
index >= numValues()
InvalidConversionException
- if this element is not an array of
Sequence or Choice elementspublic abstract boolean getValueAsBool()
Same as calling getValueAsBool(0)
InvalidConversionException
- if the value of this element cannot
be converted to a boolean
java.lang.IndexOutOfBoundsException
- if
numValues()
== 0
getValueAsBool(int)
public abstract boolean getValueAsBool(int index)
If the datatype of the element at the specified index is not boolean this method attempts to convert it to a boolean.
index
- the index of the element whose value is requested
InvalidConversionException
- if the value of the element at the
specified index cannot be converted to a boolean
java.lang.IndexOutOfBoundsException
- if
index >= numValues()
public abstract char getValueAsChar()
Same as calling getValueAsChar(0)
InvalidConversionException
- if the value of this element cannot
be converted to a char
java.lang.IndexOutOfBoundsException
- if
numValues()
== 0
getValueAsChar(int)
public abstract char getValueAsChar(int index)
If the datatype of the element at the specified index is not char this method attempts to convert it to a char.
index
- the index of the element whose value is requested
java.lang.IndexOutOfBoundsException
- if index >= numValues()
public abstract int getValueAsInt32()
Same as calling getValueAsInt32(0)
InvalidConversionException
- if the value of this element cannot
be converted to a int
java.lang.IndexOutOfBoundsException
- if
numValues()
== 0
getValueAsInt32(int)
public abstract int getValueAsInt32(int index)
If the datatype of the element at the specified index is not int this method attempts to convert it to a int.
index
- the index of the element whose value is requested
InvalidConversionException
- if the value of the element at the
specified index cannot be converted to a int
java.lang.IndexOutOfBoundsException
- if index >= numValues()
public abstract long getValueAsInt64()
Same as calling getValueAsInt64(0)
InvalidConversionException
- if the value of this element cannot
be converted to a long
java.lang.IndexOutOfBoundsException
- if
numValues()
== 0
getValueAsInt64(int)
public abstract long getValueAsInt64(int index)
If the datatype of the element at the specified index is not long this method attempts to convert it to a long.
index
- the index of the element whose value is requested
InvalidConversionException
- if the value of the element at the
specified index cannot be converted to a long
java.lang.IndexOutOfBoundsException
- if index >= numValues()
public abstract double getValueAsFloat64()
Same as calling getValueAsFloat64(0)
InvalidConversionException
- if the value of this element cannot
be converted to a double
java.lang.IndexOutOfBoundsException
- if
numValues()
== 0
getValueAsFloat64(int)
public abstract double getValueAsFloat64(int index)
If the datatype of the element at the specified index is not double this method attempts to convert it to a double.
index
- the index of the element whose value is requested
InvalidConversionException
- if the value of the element at the
specified index cannot be converted to a double
java.lang.IndexOutOfBoundsException
- if index >= numValues()
public abstract float getValueAsFloat32() throws InvalidConversionException
Same as calling getValueAsFloat32(0)
InvalidConversionException
- if the value of this element cannot
be converted to a float
java.lang.IndexOutOfBoundsException
- if
numValues()
== 0
getValueAsFloat32(int)
public abstract float getValueAsFloat32(int index)
If the datatype of the element at the specified index is not float this method attempts to convert it to a float.
index
- the index of the element whose value is requested
InvalidConversionException
- if the value of the element at the
specified index cannot be converted to a float
java.lang.IndexOutOfBoundsException
- if index >= numValues()
public abstract java.lang.String getValueAsString()
Same as calling getValueAsString(0)
InvalidConversionException
- if the value of this element cannot
be converted to a String
java.lang.IndexOutOfBoundsException
- if
numValues()
== 0
getValueAsString(int)
public abstract java.lang.String getValueAsString(int index)
If the datatype of the element at the specified index is not String this method attempts to convert it to a String.
index
- the index of the element whose value is requested
InvalidConversionException
- if the value of the element at the
specified index cannot be converted to a String
java.lang.IndexOutOfBoundsException
- if index >= numValues()
public abstract byte[] getValueAsBytes()
Same as calling getValueAsBytes(0)
InvalidConversionException
- if the value of this element cannot
be converted to a byte array
java.lang.IndexOutOfBoundsException
- if
numValues()
== 0
getValueAsBytes(int)
public abstract byte[] getValueAsBytes(int index)
If the datatype of the element at the specified index is not byte array this method attempts to convert it to a byte array.
index
- the index of the element whose value is requested
InvalidConversionException
- if the value of the element at the
specified index cannot be converted to a byte array
java.lang.IndexOutOfBoundsException
- if index >= numValues()
public abstract Datetime getValueAsDatetime()
Same as calling getValueAsDatetime(0)
InvalidConversionException
- if the value of this element cannot
be converted to a Datetime
java.lang.IndexOutOfBoundsException
- if
numValues()
== 0
getValueAsDatetime(int)
public abstract Datetime getValueAsDatetime(int index)
If the datatype of the element at the specified index is not Datetime this method attempts to convert it to a Datetime.
index
- the index of the element whose value is requested
InvalidConversionException
- if the value of the element at the
specified index cannot be converted to a Datetime
java.lang.IndexOutOfBoundsException
- if index >= numValues()
public abstract Datetime getValueAsDate()
Same as calling getValueAsDate(0)
InvalidConversionException
- if the value of this element cannot
be converted to a Date
java.lang.IndexOutOfBoundsException
- if
numValues()
== 0
getValueAsDate(int)
public abstract Datetime getValueAsDate(int index)
If the datatype of the element at the specified index is not Date this method attempts to convert it to a Date.
index
- the index of the element whose value is requested
InvalidConversionException
- if the value of the element at the
specified index cannot be converted to a Date
java.lang.IndexOutOfBoundsException
- if index >= numValues()
public abstract Datetime getValueAsTime()
Same as calling getValueAsTime(0)
InvalidConversionException
- if the value of this element cannot
be converted to a Time
java.lang.IndexOutOfBoundsException
- if
numValues()
== 0
getValueAsTime(int)
public abstract Datetime getValueAsTime(int index)
If the datatype of the element at the specified index is not Time this method attempts to convert it to a Time.
index
- the index of the element whose value is requested
InvalidConversionException
- if the value of the element at the
specified index cannot be converted to a Time
java.lang.IndexOutOfBoundsException
- if index >= numValues()
public abstract Constant getValueAsEnumeration()
Same as calling getValueAsEnumeration(0)
InvalidConversionException
- if the value of this element cannot
be converted to an Enumeration
java.lang.IndexOutOfBoundsException
- if
numValues()
== 0
getValueAsEnumeration(int)
public abstract Constant getValueAsEnumeration(int index)
index
- the index of the element whose value is requested
InvalidConversionException
- if the value of the element at the
specified index cannot be converted to a Enumeration constant
java.lang.IndexOutOfBoundsException
- if index >= numValues()
public abstract Name getValueAsName()
Same as calling getValueAsName(0)
InvalidConversionException
- if the value of this element cannot
be converted to an Enumeration
java.lang.IndexOutOfBoundsException
- if
numValues()
== 0
getValueAsEnumeration(int)
public abstract Name getValueAsName(int index)
index
- the index of the element whose value is requested
InvalidConversionException
- if the value of the element at the
specified index cannot be converted to a Enumeration constant
java.lang.IndexOutOfBoundsException
- if index >= numValues()
public abstract boolean hasElement(Name name)
hasElement(name, false)
name
- the name of the element whose existence is being queried
java.lang.UnsupportedOperationException
- if called on non complex typepublic abstract boolean hasElement(Name name, boolean excludeNullElements)
Null elements are ignored if the excludeNullElements parameter is true. They are included otherwise
java.lang.UnsupportedOperationException
- if called on non complex typepublic abstract boolean hasElement(java.lang.String name)
hasElement(name, false
name
- the name of the element whose existence is being queried
java.lang.UnsupportedOperationException
- if called on non complex typepublic abstract boolean hasElement(java.lang.String name, boolean excludeNullElements)
Null elements are ignored if the excludeNullElements parameter is true. They are included otherwise
java.lang.UnsupportedOperationException
- if called on non complex typepublic abstract Element getElement(int position)
The position is the zero based position of all sub-elements that are currently present in this element.
position
-
NotFoundException
- if position >= numElements()
public abstract Element getElement(Name name)
This function looks up the named sub-element. If the name does not exist then as a convenience this method creates the sub-element (if the element is modifiable) and returns the newly created sub-element.
name
- the name of the required sub-element
NotFoundException
- if the named sub-element is not available
java.lang.UnsupportedOperationException
- if called on non complex typepublic abstract Element getElement(java.lang.String name)
This function looks up the named sub-element. If the name does not exist then as a convenience this method creates the sub-element (if the element is modifiable) and returns the newly created sub-element.
name
- the name of the required sub-element
NotFoundException
- if the named sub-element is not available
java.lang.UnsupportedOperationException
- if called on non complex typepublic abstract boolean getElementAsBool(Name name)
same as calling getElement(Name)
.getValueAsBool()
NotFoundException
- if the named sub-element does not exist
InvalidConversionException
- if the value of the named sub-element
cannot be converted to a boolean
java.lang.UnsupportedOperationException
- if called on non complex typepublic abstract boolean getElementAsBool(java.lang.String name)
same as calling getElement(String)
.getValueAsBool()
NotFoundException
- if the named sub-element does not exist
InvalidConversionException
- if the value of the named sub-element
cannot be converted to a boolean
java.lang.UnsupportedOperationException
- if called on non complex typepublic abstract char getElementAsChar(Name name)
same as calling getElement(Name)
.getValueAsChar()
NotFoundException
- if the named sub-element does not exist
InvalidConversionException
- if the value of the named sub-element
cannot be converted to a charpublic abstract char getElementAsChar(java.lang.String name)
same as calling getElement(String)
.getValueAsChar()
NotFoundException
- if the named sub-element does not exist
InvalidConversionException
- if the value of the named sub-element
cannot be converted to a charpublic abstract int getElementAsInt32(Name name)
same as calling getElement(Name)
.getValueAsInt32()
NotFoundException
- if the named sub-element does not exist
InvalidConversionException
- if the value of the named sub-element
cannot be converted to a intpublic abstract int getElementAsInt32(java.lang.String name)
same as calling getElement(String)
.getValueAsInt32()
NotFoundException
- if the named sub-element does not exist
InvalidConversionException
- if the value of the named sub-element
cannot be converted to a intpublic abstract long getElementAsInt64(Name name)
same as calling getElement(Name)
.getValueAsInt64()
NotFoundException
- if the named sub-element does not exist
InvalidConversionException
- if the value of the named sub-element
cannot be converted to a longpublic abstract long getElementAsInt64(java.lang.String name)
same as calling getElement(String)
.getValueAsInt32()
NotFoundException
- if the named sub-element does not exist
InvalidConversionException
- if the value of the named sub-element
cannot be converted to a longpublic abstract double getElementAsFloat64(Name name)
same as calling getElement(Name)
.getValueAsFloat64()
NotFoundException
- if the named sub-element does not exist
InvalidConversionException
- if the value of the named sub-element
cannot be converted to a doublepublic abstract double getElementAsFloat64(java.lang.String name)
same as calling getElement(String)
.getValueAsFloat64()
NotFoundException
- if the named sub-element does not exist
InvalidConversionException
- if the value of the named sub-element
cannot be converted to a doublepublic abstract float getElementAsFloat32(Name name)
same as calling getElement(Name)
.getValueAsFloat32()
NotFoundException
- if the named sub-element does not exist
InvalidConversionException
- if the value of the named sub-element
cannot be converted to a floatpublic abstract float getElementAsFloat32(java.lang.String name)
same as calling getElement(String)
.getValueAsFloat32()
NotFoundException
- if the named sub-element does not exist
InvalidConversionException
- if the value of the named sub-element
cannot be converted to a floatpublic abstract java.lang.String getElementAsString(Name name)
same as calling getElement(Name)
.getValueAsString()
NotFoundException
- if the named sub-element does not exist
InvalidConversionException
- if the value of the named sub-element
cannot be converted to a Stringpublic abstract java.lang.String getElementAsString(java.lang.String name)
same as calling getElement(String)
.getValueAsString()
NotFoundException
- if the named sub-element does not exist
InvalidConversionException
- if the value of the named sub-element
cannot be converted to a Stringpublic abstract byte[] getElementAsBytes(Name name)
same as calling getElement(Name)
.getValueAsBytes()
NotFoundException
- if the named sub-element does not exist
InvalidConversionException
- if the value of the named sub-element
cannot be converted to a byte arraypublic abstract byte[] getElementAsBytes(java.lang.String name)
same as calling getElement(String)
.getValueAsBytes()
NotFoundException
- if the named sub-element does not exist
InvalidConversionException
- if the value of the named sub-element
cannot be converted to a byte arraypublic abstract Datetime getElementAsDatetime(Name name)
same as calling getElement(Name)
.getValueAsDatetime()
NotFoundException
- if the named sub-element does not exist
InvalidConversionException
- if the value of the named sub-element
cannot be converted to a Datetimepublic abstract Datetime getElementAsDatetime(java.lang.String name)
same as calling getElement(String)
.getValueAsDatetime()
NotFoundException
- if the named sub-element does not exist
InvalidConversionException
- if the value of the named sub-element
cannot be converted to a Datetimepublic abstract Datetime getElementAsDate(Name name)
same as calling getElement(Name)
.getValueAsDate()
NotFoundException
- if the named sub-element does not exist
InvalidConversionException
- if the value of the named sub-element
cannot be converted to a Datepublic abstract Datetime getElementAsDate(java.lang.String name)
same as calling getElement(String)
.getValueAsDate()
NotFoundException
- if the named sub-element does not exist
InvalidConversionException
- if the value of the named sub-element
cannot be converted to a Datepublic abstract Datetime getElementAsTime(Name name)
same as calling getElement(Name)
.getValueAsTime()
NotFoundException
- if the named sub-element does not exist
InvalidConversionException
- if the value of the named sub-element
cannot be converted to a Timepublic abstract Datetime getElementAsTime(java.lang.String name)
same as calling getElement(String)
.getValueAsTime()
NotFoundException
- if the named sub-element does not exist
InvalidConversionException
- if the value of the named sub-element
cannot be converted to a Timepublic abstract Name getElementAsName(Name name)
same as calling getElement(Name)
.getValueAsName()
NotFoundException
- if the named sub-element does not exist
InvalidConversionException
- if the value of the named sub-element
cannot be converted to a Namepublic abstract Name getElementAsName(java.lang.String name)
same as calling getElement(String)
.getValueAsName()
NotFoundException
- if the named sub-element does not exist
InvalidConversionException
- if the value of the named sub-element
cannot be converted to a Namepublic abstract Element getChoice()
public abstract java.lang.String toString()
toString
in class java.lang.Object
public abstract void print(java.io.OutputStream output) throws java.io.IOException
java.io.IOException
public abstract void print(java.io.Writer writer) throws java.io.IOException
java.io.IOException
public abstract java.lang.Object clone()
clone
in class java.lang.Object
public abstract Element appendElement()
java.lang.UnsupportedOperationException
- if called on an element that is
not an array of Sequence or Choice or if the element is not
modifiablepublic abstract void appendValue(boolean value)
value
- the value to be appended to this array element
java.lang.UnsupportedOperationException
- if called on a non-array or if
the element is read-only
InvalidConversionException
- if the specified value cannot be
converted to the data type of the arraypublic abstract void appendValue(char value)
value
- the value to be appended to this array element
java.lang.UnsupportedOperationException
- if called on a non-array or if
the element is read-only
InvalidConversionException
- if the specified value cannot be
converted to the data type of the arraypublic abstract void appendValue(int value)
value
- the value to be appended to this array element
java.lang.UnsupportedOperationException
- if called on a non-array or if
the element is read-only
InvalidConversionException
- if the specified value cannot be
converted to the data type of the arraypublic abstract void appendValue(long value)
value
- the value to be appended to this array element
java.lang.UnsupportedOperationException
- if called on a non-array or if
the element is read-only
InvalidConversionException
- if the specified value cannot be
converted to the data type of the arraypublic abstract void appendValue(double value)
value
- the value to be appended to this array element
java.lang.UnsupportedOperationException
- if called on a non-array or if
the element is read-only
InvalidConversionException
- if the specified value cannot be
converted to the data type of the arraypublic abstract void appendValue(float value)
value
- the value to be appended to this array element
java.lang.UnsupportedOperationException
- if called on a non-array or if
the element is read-only
InvalidConversionException
- if the specified value cannot be
converted to the data type of the arraypublic abstract void appendValue(Datetime value)
value
- the value to be appended to this array element
java.lang.UnsupportedOperationException
- if called on a non-array or if
the element is read-only
InvalidConversionException
- if the specified value cannot be
converted to the data type of the arraypublic abstract void appendValue(Constant value)
value
- the value to be appended to this array element
java.lang.UnsupportedOperationException
- if called on a non-array or if
the element is read-only
InvalidConversionException
- if the specified value cannot be
converted to the data type of the arraypublic abstract void appendValue(Name value)
value
- the value to be appended to this array element
java.lang.UnsupportedOperationException
- if called on a non-array or if
the element is read-only
InvalidConversionException
- if the specified value cannot be
converted to the data type of the arraypublic abstract void appendValue(java.lang.String value)
value
- the value to be appended to this array element
java.lang.UnsupportedOperationException
- if called on a non-array or if
the element is read-only
InvalidConversionException
- if the specified value cannot be
converted to the data type of the arraypublic abstract void appendValue(byte[] value)
value
- the value to be appended to this array element
java.lang.UnsupportedOperationException
- if called on a non-array or if
the element is read-only
InvalidConversionException
- if the specified value cannot be
converted to the data type of the arraypublic abstract void setElement(Name name, boolean value)
name
- the Name of the sub-element to setvalue
- the value to be set for the specified element
NotFoundException
- if the named sub-element cannot be found
InvalidConversionException
- if the element specified by name
cannot be initialized with the specified value.
java.lang.UnsupportedOperationException
- if this element is not a sequence
or choice or if this element is read-onlypublic abstract void setElement(java.lang.String name, boolean value)
name
- the Name of the sub-element to setvalue
- the value to be set for the specified element
NotFoundException
- if the named sub-element cannot be found
InvalidConversionException
- if the element specified by name
cannot be initialized with the specified value.
java.lang.UnsupportedOperationException
- if this element is not a sequence
or choice or if this element is read-onlypublic abstract void setElement(Name name, char value)
name
- the Name of the sub-element to setvalue
- the value to be set for the specified element
NotFoundException
- if the named sub-element cannot be found
InvalidConversionException
- if the element specified by name
cannot be initialized with the specified value.
java.lang.UnsupportedOperationException
- if this element is not a sequence
or choice or if this element is read-onlypublic abstract void setElement(java.lang.String name, char value)
name
- the Name of the sub-element to setvalue
- the value to be set for the specified element
NotFoundException
- if the named sub-element cannot be found
InvalidConversionException
- if the element specified by name
cannot be initialized with the specified value.
java.lang.UnsupportedOperationException
- if this element is not a sequence
or choice or if this element is read-onlypublic abstract void setElement(Name name, int value)
name
- the Name of the sub-element to setvalue
- the value to be set for the specified element
NotFoundException
- if the named sub-element cannot be found
InvalidConversionException
- if the element specified by name
cannot be initialized with the specified value.
java.lang.UnsupportedOperationException
- if this element is not a sequence
or choice or if this element is read-onlypublic abstract void setElement(java.lang.String name, int value)
name
- the Name of the sub-element to setvalue
- the value to be set for the specified element
NotFoundException
- if the named sub-element cannot be found
InvalidConversionException
- if the element specified by name
cannot be initialized with the specified value.
java.lang.UnsupportedOperationException
- if this element is not a sequence
or choice or if this element is read-onlypublic abstract void setElement(Name name, long value)
name
- the Name of the sub-element to setvalue
- the value to be set for the specified element
NotFoundException
- if the named sub-element cannot be found
InvalidConversionException
- if the element specified by name
cannot be initialized with the specified value.
java.lang.UnsupportedOperationException
- if this element is not a sequence
or choice or if this element is read-onlypublic abstract void setElement(java.lang.String name, long value)
name
- the Name of the sub-element to setvalue
- the value to be set for the specified element
NotFoundException
- if the named sub-element cannot be found
InvalidConversionException
- if the element specified by name
cannot be initialized with the specified value.
java.lang.UnsupportedOperationException
- if this element is not a sequence
or choice or if this element is read-onlypublic abstract void setElement(Name name, double value)
name
- the Name of the sub-element to setvalue
- the value to be set for the specified element
NotFoundException
- if the named sub-element cannot be found
InvalidConversionException
- if the element specified by name
cannot be initialized with the specified value.
java.lang.UnsupportedOperationException
- if this element is not a sequence
or choice or if this element is read-onlypublic abstract void setElement(java.lang.String name, double value)
name
- the Name of the sub-element to setvalue
- the value to be set for the specified element
NotFoundException
- if the named sub-element cannot be found
InvalidConversionException
- if the element specified by name
cannot be initialized with the specified value.
java.lang.UnsupportedOperationException
- if this element is not a sequence
or choice or if this element is read-onlypublic abstract void setElement(Name name, float value)
name
- the Name of the sub-element to setvalue
- the value to be set for the specified element
NotFoundException
- if the named sub-element cannot be found
InvalidConversionException
- if the element specified by name
cannot be initialized with the specified value.
java.lang.UnsupportedOperationException
- if this element is not a sequence
or choice or if this element is read-onlypublic abstract void setElement(java.lang.String name, float value)
name
- the Name of the sub-element to setvalue
- the value to be set for the specified element
NotFoundException
- if the named sub-element cannot be found
InvalidConversionException
- if the element specified by name
cannot be initialized with the specified value.
java.lang.UnsupportedOperationException
- if this element is not a sequence
or choice or if this element is read-onlypublic abstract void setElement(Name name, Datetime value)
name
- the Name of the sub-element to setvalue
- the value to be set for the specified element
NotFoundException
- if the named sub-element cannot be found
InvalidConversionException
- if the element specified by name
cannot be initialized with the specified value.
java.lang.UnsupportedOperationException
- if this element is not a sequence
or choice or if this element is read-onlypublic abstract void setElement(java.lang.String name, Datetime value)
name
- the Name of the sub-element to setvalue
- the value to be set for the specified element
NotFoundException
- if the named sub-element cannot be found
InvalidConversionException
- if the element specified by name
cannot be initialized with the specified value.
java.lang.UnsupportedOperationException
- if this element is not a sequence
or choice or if this element is read-onlypublic abstract void setElement(Name name, Constant value)
name
- the Name of the sub-element to setvalue
- the value to be set for the specified element
NotFoundException
- if the named sub-element cannot be found
InvalidConversionException
- if the element specified by name
cannot be initialized with the specified value.
java.lang.UnsupportedOperationException
- if this element is not a sequence
or choice or if this element is read-onlypublic abstract void setElement(java.lang.String name, Constant value)
name
- the Name of the sub-element to setvalue
- the value to be set for the specified element
NotFoundException
- if the named sub-element cannot be found
InvalidConversionException
- if the element specified by name
cannot be initialized with the specified value.
java.lang.UnsupportedOperationException
- if this element is not a sequence
or choice or if this element is read-onlypublic abstract void setElement(Name name, Name value)
name
- the Name of the sub-element to setvalue
- the value to be set for the specified element
NotFoundException
- if the named sub-element cannot be found
InvalidConversionException
- if the element specified by name
cannot be initialized with the specified value.
java.lang.UnsupportedOperationException
- if this element is not a sequence
or choice or if this element is read-onlypublic abstract void setElement(java.lang.String name, Name value)
name
- the Name of the sub-element to setvalue
- the value to be set for the specified element
NotFoundException
- if the named sub-element cannot be found
InvalidConversionException
- if the element specified by name
cannot be initialized with the specified value.
java.lang.UnsupportedOperationException
- if this element is not a sequence
or choice or if this element is read-onlypublic abstract void setElement(Name name, java.lang.String value)
name
- the Name of the sub-element to setvalue
- the value to be set for the specified element
NotFoundException
- if the named sub-element cannot be found
InvalidConversionException
- if the element specified by name
cannot be initialized with the specified value.
java.lang.UnsupportedOperationException
- if this element is not a sequence
or choice or if this element is read-onlypublic abstract void setElement(java.lang.String name, java.lang.String value)
name
- the Name of the sub-element to setvalue
- the value to be set for the specified element
NotFoundException
- if the named sub-element cannot be found
InvalidConversionException
- if the element specified by name
cannot be initialized with the specified value.
java.lang.UnsupportedOperationException
- if this element is not a sequence
or choice or if this element is read-onlypublic abstract void setElement(Name name, byte[] value)
name
- the Name of the sub-element to setvalue
- the value to be set for the specified element
NotFoundException
- if the named sub-element cannot be found
InvalidConversionException
- if the element specified by name
cannot be initialized with the specified value.
java.lang.UnsupportedOperationException
- if this element is not a sequence
or choice or if this element is read-onlypublic abstract void setElement(java.lang.String name, byte[] value)
name
- the Name of the sub-element to setvalue
- the value to be set for the specified element
NotFoundException
- if the named sub-element cannot be found
InvalidConversionException
- if the element specified by name
cannot be initialized with the specified value.
java.lang.UnsupportedOperationException
- if this element is not a sequence
or choice or if this element is read-onlypublic abstract Element setChoice(Name name)
Note that if this choice element already contains a selection it is discarded and the the choice's selection is set to the named sub-element
name
- Name of the sub-element to set the choice to
NotFoundException
- if the named sub-element cannot be found
java.lang.UnsupportedOperationException
- if this element is not a choice
or if this element is read-onlypublic abstract Element setChoice(java.lang.String name)
Note that if this choice element already contains a selection it is discarded and the the choice's selection is set to the named sub-element
name
- Name of the sub-element to set the choice to
NotFoundException
- if the named sub-element cannot be found
java.lang.UnsupportedOperationException
- if this element is not a choice
or if this element is read-onlypublic abstract void setValue(boolean value)
setValue(value, 0)
InvalidConversionException
- if this element cannot be initialized
with the specified valuepublic abstract void setValue(boolean value, int index)
InvalidConversionException
- if the element at the specified index
cannot be initialized with the specified value
java.lang.IndexOutOfBoundsException
- if index >=
numValues()
public abstract void setValue(char value)
setValue(value, 0)
InvalidConversionException
- if this element cannot be initialized
with the specified valuepublic abstract void setValue(char value, int index)
InvalidConversionException
- if the element at the specified index
cannot be initialized with the specified value
java.lang.IndexOutOfBoundsException
- if index >=
numValues()
public abstract void setValue(int value)
setValue(value, 0)
InvalidConversionException
- if this element cannot be initialized
with the specified valuepublic abstract void setValue(int value, int index)
InvalidConversionException
- if the element at the specified index
cannot be initialized with the specified value
java.lang.IndexOutOfBoundsException
- if index >=
numValues()
public abstract void setValue(long value)
setValue(value, 0)
InvalidConversionException
- if this element cannot be initialized
with the specified valuepublic abstract void setValue(long value, int index)
InvalidConversionException
- if the element at the specified index
cannot be initialized with the specified value
java.lang.IndexOutOfBoundsException
- if index >=
numValues()
public abstract void setValue(double value)
setValue(value, 0)
InvalidConversionException
- if this element cannot be initialized
with the specified valuepublic abstract void setValue(double value, int index)
InvalidConversionException
- if the element at the specified index
cannot be initialized with the specified value
java.lang.IndexOutOfBoundsException
- if index >=
numValues()
public abstract void setValue(float value)
setValue(value, 0)
InvalidConversionException
- if this element cannot be initialized
with the specified valuepublic abstract void setValue(float value, int index)
InvalidConversionException
- if the element at the specified index
cannot be initialized with the specified value
java.lang.IndexOutOfBoundsException
- if index >=
numValues()
public abstract void setValue(Datetime value)
setValue(value, 0)
InvalidConversionException
- if this element cannot be initialized
with the specified valuepublic abstract void setValue(Datetime value, int index)
InvalidConversionException
- if the element at the specified index
cannot be initialized with the specified value
java.lang.IndexOutOfBoundsException
- if index >=
numValues()
public abstract void setValue(Constant constant)
setValue(value, 0)
InvalidConversionException
- if this element cannot be initialized
with the specified valuepublic abstract void setValue(Constant constant, int index)
InvalidConversionException
- if the element at the specified index
cannot be initialized with the specified value
java.lang.IndexOutOfBoundsException
- if index >=
numValues()
public abstract void setValue(Name constant)
setValue(value, 0)
InvalidConversionException
- if this element cannot be initialized
with the specified valuepublic abstract void setValue(Name constant, int index)
InvalidConversionException
- if the element at the specified index
cannot be initialized with the specified value
java.lang.IndexOutOfBoundsException
- if index >=
numValues()
public abstract void setValue(java.lang.String value)
setValue(value, 0)
InvalidConversionException
- if this element cannot be initialized
with the specified valuepublic abstract void setValue(java.lang.String value, int index)
InvalidConversionException
- if the element at the specified index
cannot be initialized with the specified value
java.lang.IndexOutOfBoundsException
- if index >=
numValues()
public abstract void setValue(byte[] value)
setValue(value, 0)
InvalidConversionException
- if this element cannot be initialized
with the specified valuepublic abstract void setValue(byte[] value, int index)
InvalidConversionException
- if the element at the specified index
cannot be initialized with the specified value
java.lang.IndexOutOfBoundsException
- if index >=
numValues()
public ElementIterator elementIterator()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |