com.candle.roma.kxm
Class KxmField

java.lang.Object
  |
  +--com.candle.roma.kxm.KxmField
Direct Known Subclasses:
KxmMessage

public class KxmField
extends java.lang.Object

The KxmField class provides an interface to access a single field of a message: set and get a field value, get nested fields, and get field information. The KxmField object has two states: bound and unbound. It is bound when it refers to some message field and unbound otherwise. The KxmField.getField() method provided by the KxmMessage object is the primary method to get bound KxmField objects. Note that a KxmField object does not encapsulate the message field, but only provides access to it.

See Also:
KxmMessage, KxmDate, KxmQName, KxmDuration, KxmException, KxmRange

Field Summary
static int DTYPE_DATE
          Date field type.
static int DTYPE_DATETIME
          Date field type.
static int DTYPE_GDAY
          Date field type.
static int DTYPE_GMONTH
          Date field type.
static int DTYPE_GMONTHDAY
          Date field type.
static int DTYPE_GYEAR
          Date field type.
static int DTYPE_GYEARMONTH
          Date field type.
static int DTYPE_NONE
          Date field type.
static int DTYPE_TIME
          Date field type.
static int EXACT
          Field search option.
static int FLAG_ARRAY
          Field flag.
static int FLAG_DEFAULT_VALUE
          Field flag.
static int FLAG_GROUP
          Field flag.
static int FLAG_ROOT
          Field flag.
static int FLAG_UNION
          Field flag.
static int FLAG_XMLATTR
          Field flag.
static int FLAG_XMLDOC
          Field flag.
static int FLAG_XMLELEM
          Field flag.
static int GET_SCHEMA_FIELDS
          Field feature option.
static int NTYPE_DECIMAL
          Numeric field type.
static int NTYPE_DOUBLE
          Numeric field type.
static int NTYPE_FLOAT
          Numeric field type.
static int NTYPE_INT16
          Numeric field type.
static int NTYPE_INT32
          Numeric field type.
static int NTYPE_INT64
          Numeric field type.
static int NTYPE_INT8
          Numeric field type.
static int NTYPE_INTEGER
          Numeric field type.
static int NTYPE_NONE
          Numeric field type.
static int NTYPE_UINT16
          Numeric field type.
static int NTYPE_UINT32
          Numeric field type.
static int NTYPE_UINT64
          Numeric field type.
static int NTYPE_UINT8
          Numeric field type.
static int SEARCH
          Field search option.
static int TYPE_BINARY
          Field type.
static int TYPE_BOOL
          Field type.
static int TYPE_DATE
          Field type.
static int TYPE_DURATION
          Field type.
static int TYPE_GROUP
          Field type.
static int TYPE_NUMBER
          Field type.
static int TYPE_QNAME
          Field type.
static int TYPE_STRING
          Field type.
static int TYPE_XMLATTR
          Field type.
static int TYPE_XMLELEM
          Field type.
static int UNIQUE
          Field search option.
 
Method Summary
 KxmField applyFormat(int format)
          Apply the specified format to the field.
 KxmField applyFormat(KxmFieldFormat format)
          Apply the specified format to the field.
 KxmField at(int index)
          Returns an array element at the specified index.
 void declareNs(java.lang.String fieldName, java.lang.String prefix, java.lang.String uri)
          Declares an XML namespace on the specified field.
 KxmField findField(java.lang.String fieldName)
          Returns the sub-field with the given name.
 KxmField findField(java.lang.String fieldName, int options)
          Returns the sub-field with the given name.
 int getArrayLen()
          Returns the current number of elements in the array (a repeated group or a repeated XML element).
 KxmRange getArrayLenRange()
          Returns minimum and maximum number of array elements.
 boolean getBool()
          Returns a boolean value of the field.
 byte[] getByteArray()
          Returns a binary stream value of the field.
 java.lang.String getCharacterData()
          Returns character data of the XML field.
 KxmDate getDate()
          Returns a date value of the field.
 int getDateType()
          Returns a date field type.
 KxmField getDefault()
          Returns a field object representing the default value of this field.
 double getDouble()
          Returns a double value of the field.
 KxmDuration getDuration()
          Returns a duration value of the field.
 KxmField getField(int index)
          Returns an array element at the index.
 KxmField getField(int index, int options)
          Returns an array element at the index.
 KxmField getField(java.lang.String fieldName)
          Returns a sub-field with the given name.
 KxmField getField(java.lang.String fieldName, int options)
          Returns a sub-field with the given name.
 int getFlags()
          Returns field flags.
 long getHandle()
           
 java.lang.String getLocalPart()
          Returns a local part of the XML field name.
 long getLong()
          Returns a long value of the field.
 java.lang.String getName()
          Returns a name of the field.
 java.lang.String getNsPrefix()
          Returns an XML namespace prefix of the field.
 java.lang.String getNsUri()
          Returns an XML namespace URI of the field.
 int getNumericType()
          Returns a numeric field type.
 int getNumOfFields()
          Returns the number of fields in a group or summary number of immediate XML sub-elements and attributes for the current field.
Note: several XML fields with the same name are considered as a single array field.
 int getNumOfFields(int options)
          The same as above, but this method allows to specify the feature options.
 java.lang.Object getObject()
          Returns a value of the field as the Object.
 KxmField getParent()
          Returns a parent field.
 KxmQName getQName()
          Returns a qualified name value of the field.
 java.lang.String getString()
          Returns a string representation of the field value.
 int getType()
          Returns a field type.
 KxmRange getValueLenRange()
          Returns minimum and maximum length of a string or a binary value of the field.
 boolean isArray()
          Returns true if the field is an array.
 boolean isDefaultValue()
          Returns true if the field is a default value.
 boolean isEmpty()
          Returns true if the field has no value or the field is not present in a message.
 boolean isGroup()
          Returns true if the field can have sub-fields (the fields which have the FLAG_GROUP or the FLAG_XMLELEM flag set).
 boolean isInvalid()
          Returns true if this KxmField object is not bound to any field.
 boolean isNil()
          Returns true if the XML field is nil.
 boolean isRoot()
          Returns true if the field is the root field of a message.
static void loadMessageApi()
           
 void set(byte[] data)
          Sets a binary data to the field.
 void set(double d)
          Sets a double value to the field.
 void set(KxmDate date)
          Sets a date/time value to the field.
 void set(KxmDuration dur)
          Sets a duration value to the field.
 void set(KxmField field)
          Sets the field with a content of another field.
 void set(KxmQName qname)
          Sets a qualified name value to the field.
 void set(long l)
          Sets a long value to the field.
 void set(java.lang.Object a)
          Sets an Object to the field.
 void set(java.lang.String str)
          Sets a string value to the field.
 void setArrayLen(int l)
          Sets the new length for the array.
 void setBool(boolean bool)
          Sets a boolean value to the field.
 void setCharacterData(java.lang.String data)
          Sets character data of the XML field.
 void setEmpty()
          Removes content of the field.
 void setNil()
          Marks the XML field as nil.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_STRING

public static final int TYPE_STRING
Field type.
See getType()

TYPE_NUMBER

public static final int TYPE_NUMBER
Field type.
See getType()

TYPE_BINARY

public static final int TYPE_BINARY
Field type.
See getType()

TYPE_XMLELEM

public static final int TYPE_XMLELEM
Field type.
See getType()

TYPE_XMLATTR

public static final int TYPE_XMLATTR
Field type.
See getType()

TYPE_DATE

public static final int TYPE_DATE
Field type.
See getType()

TYPE_GROUP

public static final int TYPE_GROUP
Field type.
See getType()

TYPE_BOOL

public static final int TYPE_BOOL
Field type.
See getType()

TYPE_QNAME

public static final int TYPE_QNAME
Field type.
See getType()

TYPE_DURATION

public static final int TYPE_DURATION
Field type.
See getType()

NTYPE_NONE

public static final int NTYPE_NONE
Numeric field type.
See getNumericType()

NTYPE_UINT8

public static final int NTYPE_UINT8
Numeric field type.
See getNumericType()

NTYPE_INT8

public static final int NTYPE_INT8
Numeric field type.
See getNumericType()

NTYPE_UINT16

public static final int NTYPE_UINT16
Numeric field type.
See getNumericType()

NTYPE_INT16

public static final int NTYPE_INT16
Numeric field type.
See getNumericType()

NTYPE_UINT32

public static final int NTYPE_UINT32
Numeric field type.
See getNumericType()

NTYPE_INT32

public static final int NTYPE_INT32
Numeric field type.
See getNumericType()

NTYPE_DECIMAL

public static final int NTYPE_DECIMAL
Numeric field type.
See getNumericType()

NTYPE_INTEGER

public static final int NTYPE_INTEGER
Numeric field type.
See getNumericType()

NTYPE_DOUBLE

public static final int NTYPE_DOUBLE
Numeric field type.
See getNumericType()

NTYPE_UINT64

public static final int NTYPE_UINT64
Numeric field type.
See getNumericType()

NTYPE_INT64

public static final int NTYPE_INT64
Numeric field type.
See getNumericType()

NTYPE_FLOAT

public static final int NTYPE_FLOAT
Numeric field type.
See getNumericType()

EXACT

public static final int EXACT
Field search option.
See getField(String fieldName,int opt)

SEARCH

public static final int SEARCH
Field search option.
See getField(String fieldName,int opt)

UNIQUE

public static final int UNIQUE
Field search option.
See getField(String fieldName,int opt)

DTYPE_NONE

public static final int DTYPE_NONE
Date field type.
See getDateType()

DTYPE_DATE

public static final int DTYPE_DATE
Date field type.
See getDateType()

DTYPE_TIME

public static final int DTYPE_TIME
Date field type.
See getDateType()

DTYPE_DATETIME

public static final int DTYPE_DATETIME
Date field type.
See getDateType()

DTYPE_GYEAR

public static final int DTYPE_GYEAR
Date field type.
See getDateType()

DTYPE_GYEARMONTH

public static final int DTYPE_GYEARMONTH
Date field type.
See getDateType()

DTYPE_GMONTHDAY

public static final int DTYPE_GMONTHDAY
Date field type.
See getDateType()

DTYPE_GDAY

public static final int DTYPE_GDAY
Date field type.
See getDateType()

DTYPE_GMONTH

public static final int DTYPE_GMONTH
Date field type.
See getDateType()

GET_SCHEMA_FIELDS

public static final int GET_SCHEMA_FIELDS
Field feature option.
See getNumOfFields(int options) See getField(int index, int options)

FLAG_ROOT

public static final int FLAG_ROOT
Field flag.
See getFlags()

FLAG_ARRAY

public static final int FLAG_ARRAY
Field flag.
See getFlags()

FLAG_GROUP

public static final int FLAG_GROUP
Field flag.
See getFlags()

FLAG_DEFAULT_VALUE

public static final int FLAG_DEFAULT_VALUE
Field flag.
See getFlags()

FLAG_UNION

public static final int FLAG_UNION
Field flag.
See getFlags()

FLAG_XMLELEM

public static final int FLAG_XMLELEM
Field flag.
See getFlags()

FLAG_XMLATTR

public static final int FLAG_XMLATTR
Field flag.
See getFlags()

FLAG_XMLDOC

public static final int FLAG_XMLDOC
Field flag.
See getFlags()
Method Detail

getName

public java.lang.String getName()
                         throws KxmException
Returns a name of the field. For raw fields it is the name of the group item. For XML fields it is a name of the element or the attribute.
Throws:
KxmException - will be thrown on an error.

getType

public int getType()
            throws KxmException
Returns a field type. It is one of the following constants:
Throws:
KxmException - will be thrown on an error.

getNumericType

public int getNumericType()
                   throws KxmException
Returns a numeric field type. It is one of the following constants:
Throws:
KxmException - will be thrown on an error.

getDateType

public int getDateType()
                throws KxmException
Returns a date field type. It is one of the following constants:
Throws:
KxmException - will be thrown on an error.

getValueLenRange

public KxmRange getValueLenRange()
                          throws KxmException
Returns minimum and maximum length of a string or a binary value of the field.
Throws:
KxmException - will be thrown on an error.

getArrayLenRange

public KxmRange getArrayLenRange()
                          throws KxmException
Returns minimum and maximum number of array elements.
Throws:
KxmException - will be thrown on an error.

isArray

public boolean isArray()
                throws KxmException
Returns true if the field is an array.
Throws:
KxmException - will be thrown on an error.

isRoot

public boolean isRoot()
               throws KxmException
Returns true if the field is the root field of a message.
Throws:
KxmException - will be thrown on an error.

isGroup

public boolean isGroup()
                throws KxmException
Returns true if the field can have sub-fields (the fields which have the FLAG_GROUP or the FLAG_XMLELEM flag set).
Throws:
KxmException - will be thrown on an error.

isInvalid

public boolean isInvalid()
Returns true if this KxmField object is not bound to any field. This is a state of the KxmField object, but not of the message field. Note: XML fields are always valid, so to check that an XML field is present in a message, use the isEmpty() method.

isEmpty

public boolean isEmpty()
                throws KxmException
Returns true if the field has no value or the field is not present in a message.
Throws:
KxmException - will be thrown on an error.

isDefaultValue

public boolean isDefaultValue()
                       throws KxmException
Returns true if the field is a default value.
Throws:
KxmException - will be thrown on an error.

setEmpty

public void setEmpty()
              throws KxmException
Removes content of the field. It will not longer have a value or be present in the message.
Throws:
KxmException - will be thrown on an error.

getNumOfFields

public int getNumOfFields()
                   throws KxmException
Returns the number of fields in a group or summary number of immediate XML sub-elements and attributes for the current field.
Note: several XML fields with the same name are considered as a single array field.
Throws:
KxmException - will be thrown on an error.

getNumOfFields

public int getNumOfFields(int options)
                   throws KxmException
The same as above, but this method allows to specify the feature options.
Parameters:
options - Feature options. It can be a combination of the following constants:
  • KxmField.GET_SCHEMA_FIELDS - Count all fields according to the DTD or the XML Schema definition, even if they are not present in the message.
Throws:
KxmException - will be thrown on an error.

getField

public KxmField getField(java.lang.String fieldName)
                  throws KxmException
Returns a sub-field with the given name. If the field is not found, then find the sub-field at any nesting level. If the function can not find the sub-field, then it throws an exception.
Parameters:
fieldName - Name of the field.
Throws:
KxmException - will be thrown on an error.

getField

public KxmField getField(java.lang.String fieldName,
                         int options)
                  throws KxmException
Returns a sub-field with the given name. If the function can not find the sub-field, then it throws an exception.
Parameters:
fieldName - Name of the field.
opt - Search options. It should be one of the following constants:
  • KxmField.EXACT - Return the immediate sub-field (Based on the fact that the field name does not started from '*.').
  • KxmField.SEARCH - Return the immediate sub-field. If the field is not found, then find the sub-field at any nesting level.
  • KxmField.UNIQUE - Search the sub-field with a given name at any nesting level, check that it is unique - only a single sub-field matches the specified name.
Description The field name can contain the following special characters:
  • .(dot) - Separates nested fields, the same as in a C structure.
  • *(asterisk) - Indicates zero or more intermediate fields.
  • '(single quote) - Can be used to protect dots to be interpreted as field separators. The full field name to be protected should be surrounded by single quotes.
  • @ - Indicates an XML attribute. This should be the first character of the field name.
  • doc() - may be optionally enclosed in signle or double quotes.
The field name can also contain a filter over the value of an XML element attribute. The syntax is:
"elementName[@attrName=attrValue]". The back-slash ('\') has special meaning. It's purpose is to protect closing square bracket (']') appearing in attrValue to be interpreting as end of value. When back-slash appears in the string it is removed and next character is interpreted as not having special meaning.
Good Examples
The following are several good examples of syntax for referring to a field.
A.B - Field B located immediately under field A.
A.*.B - Field B located somewhere under field A.
*.B - Some field B.
A.'My.Field'.C - Field C located under "My.Field", which is located under A.
@B - XML attribute B.
A.@B - XML attribute B of A element.
A[@ID=1000].B - The first element B under the first element A with attribute ID equal to 1000.
Bad Examples The following are several bad examples of field references. A.* - Asterisk cannot be last.
A..B - Dot cannot be repeated.
A.**.B - Asterisk cannot be repeated.
A*.B - There should be a dot before the B.
A'B.C' - There should be a dot after A and before the opening quote.
A.'B.C - Unclosed quote.
@A.@B - XML attribute cannot have sub-attributes or sub-elements.
A[ID=1000] - Filter should be over an attribute value.
If the XML message does not contain a matching element or attribute, the set functions create it, including all intermediate elements as necessary. For example, setting the element "e1.e2.e3" creates intermediate elements e1 and e1.e2, if they do not already exist. It may be necessary to use the KxmField.EXACT option to ensure that the API creates the specified XML element or attribute exactly, and doesn't search for an already existing element or attribute and resets it's value.
For example, the following call resets field A.B, when you may expect creation of just B:
XML document:

10

Function call: msg.getField( "B" ).set(20);
Result:

20


With the EXACT, the creation occurs as expected:
Function call: msg.getField( "B", KxmField.EXACT ).set( 20 );
Result:

10
20

Throws:
KxmException - will be thrown on an error.

getField

public KxmField getField(int index)
                  throws KxmException
Returns an array element at the index.
Parameters:
index - A zero-based index of an array element. The array grows if the specified index is higher than the current upper bound of the array.
Throws:
KxmException - will be thrown on an error.

getField

public KxmField getField(int index,
                         int options)
                  throws KxmException
Returns an array element at the index.
Parameters:
index - A zero-based index of an array element. The array grows if the specified index is higher than the current upper bound of the array.
options - Feature options. It can be a combination of the following constants:
  • KxmField.GET_SCHEMA_FIELDS - Return the field according to the DTD or the XML Schema definition, even if the field is not present in the message.
Throws:
KxmException - will be thrown on an error.

findField

public KxmField findField(java.lang.String fieldName)
                   throws KxmException
Returns the sub-field with the given name. If the function can not find the sub-field then it returns an un-bound KxmField object (For an un-bound KxmField object isInvalid() method returns true). This function is the same as getField(String fieldName) but does not throw exceptions.
See getField(String fieldName) for details on search logic and field name syntax.
Parameters:
fieldName - Name of the field.
Throws:
KxmException - will be thrown on an error.

findField

public KxmField findField(java.lang.String fieldName,
                          int options)
                   throws KxmException
Returns the sub-field with the given name. If the function can not find the sub-field then it returns an un-bound KxmField object (For an un-bound KxmField object isInvalid() method returns true). This function is the same as getField(String fieldName) but does not throw exceptions.
See getField(String fieldName) for details on search logic and field name syntax.
Parameters:
fieldName - Name of the field.
options - Search options getField(String fieldName, int options).
Throws:
KxmException - will be thrown on an error.

getParent

public KxmField getParent()
                   throws KxmException
Returns a parent field.
Throws:
KxmException - will be thrown on an error.

getDefault

public KxmField getDefault()
                    throws KxmException
Returns a field object representing the default value of this field. Use the corresponding get() method to the get value of the appropriate type. If the field does not have a default value then an unbound KxmField object is returned.
Throws:
KxmException - will be thrown on an error.

set

public void set(java.lang.String str)
         throws KxmException
Sets a string value to the field. If the field to be set is not a string type, the function attempts to convert the string to the field's type.
If the field type is TYPE_BINARY then the string should contain a sequence of hexadecimal numbers, where each number representing a value of single byte.
If the field type is TYPE_NUMBER then the string should contain a decimal or scientific (exponent) number.
If the field type is TYPE_DATE then the string should contain a date, time or both.
Throws:
KxmException - will be thrown on an error.

set

public void set(long l)
         throws KxmException
Sets a long value to the field. The table below shows how the function processes the field based on the data type of the field. If the field is not a long data type, the function converts the value as described.
Field Data Result
string
XML element
XML attribute
Decimal representation of the number.
decimal Passed value.
int8
uint8
int16
uint16
int32
uint32
uint64
Passed value if it fits the type, error otherwise.
integer
int64
Passed value
Throws:
KxmException - will be thrown on an error.

set

public void set(double d)
         throws KxmException
Sets a double value to the field. If the field type is TYPE_STRING, TYPE_XMLELEM or TYPE_XMLATTR then the method represents a double in exponent notation with a precision of 15 decimal digits in mantissa.
The table below shows how the function processes the field based on the data type of the field.
Field Data Result
string
XML element
XML attribute
Decimal representation of passed value, exponent representation is used if double is too big or too small.
decimal representation of passed value. If the value is too big to be present in non-exponent form, an error is returned.
any other Returns an Error.
Throws:
KxmException - will be thrown on an error.

set

public void set(KxmDate date)
         throws KxmException
Sets a date/time value to the field.
Throws:
KxmException - will be thrown on an error.

set

public void set(byte[] data)
         throws KxmException
Sets a binary data to the field. If the field type is TYPE_STRING, TYPE_XMLELEM or TYPE_XMLATTR then the method represents the binary array as a sequence of hexadecimal numbers, where each number represents a value of a single byte.
Throws:
KxmException - will be thrown on an error.

set

public void set(KxmField field)
         throws KxmException
Sets the field with a content of another field.
Parameters:
field - A source field.
Throws:
KxmException - will be thrown on an error.

set

public void set(KxmQName qname)
         throws KxmException
Sets a qualified name value to the field.
Throws:
KxmException - will be thrown on an error.

set

public void set(KxmDuration dur)
         throws KxmException
Sets a duration value to the field.
Throws:
KxmException - will be thrown on an error.

setBool

public void setBool(boolean bool)
             throws KxmException
Sets a boolean value to the field.
Throws:
KxmException - will be thrown on an error.

set

public void set(java.lang.Object a)
         throws KxmException
Sets an Object to the field. The Object may be an instance of:
Long
Integer
Double
Float
BigInteger
BigDecimal
String
byte[]
Boolean
AbstractList
KxmField
KxmDate
KxmQName
KxmDuration
Throws:
KxmException - will be thrown on an error.

getString

public java.lang.String getString()
                           throws KxmException
Returns a string representation of the field value.
Throws:
KxmException - will be thrown on an error.

getLong

public long getLong()
             throws KxmException
Returns a long value of the field. The table below shows how the function processes the field based on the data type of the field. If the field is not a long data type, the function converts the field as described to provide the long value.
Field Data Result
Int8
uint8
int16
uint16
int32
Value of field.
Uint32
int64
uint64
integer
The function returns the value of a field if it is equal to or smaller than LONG_MAX. Otherwise, it returns an error.
String
XML element
XML attribute
The function tries to convert the string to an integer. Leading and trailing spaces are ignored. If the string does not contain a valid integer, or there are extra non-space symbols, or the integer is too big to fit into a long, an error is returned.
Decimal
Returns an error.
Throws:
KxmException - will be thrown on an error.

getDouble

public double getDouble()
                 throws KxmException
Returns a double value of the field. The table below shows how the function processes the field based on the data type of the field.
Field Data Result
String
XML element
XML attribute
The function tries to convert the string to a double. Leading and trailing spaces are ignored. Decimal and exponent forms are recognized. If the string does not contain a valid decimal number, or there are extra non-space symbols, an error is returned.
Decimal Converts decimal number to a double. The conversion may reduce the accuracy as a result of the decimal-to-IEEE double conversion.
String
XML element
XML attribute
The function tries to convert the string to an integer. Leading and trailing spaces are ignored. If the string does not contain a valid integer, or there are extra non-space symbols, or the integer is too big to fit into a long, an error is returned.
Any other Returns an error.
Throws:
KxmException - will be thrown on an error.

getBool

public boolean getBool()
                throws KxmException
Returns a boolean value of the field.
Throws:
KxmException - will be thrown on an error.

getQName

public KxmQName getQName()
                  throws KxmException
Returns a qualified name value of the field.
Throws:
KxmException - will be thrown on an error.

getDuration

public KxmDuration getDuration()
                        throws KxmException
Returns a duration value of the field.
Throws:
KxmException - will be thrown on an error.

getDate

public KxmDate getDate()
                throws KxmException
Returns a date value of the field.
Throws:
KxmException - will be thrown on an error.

getByteArray

public byte[] getByteArray()
                    throws KxmException
Returns a binary stream value of the field.
Throws:
KxmException - will be thrown on an error.

getObject

public java.lang.Object getObject()
                           throws KxmException
Returns a value of the field as the Object. The Object type depends on the field type:
Definition JAVA type of return Object
String
String
Number: Decimal BigDecimal
Number: Integer BigInteger
Number:
int8
uint8
int16
uint16
int32
uint32
uint64
Long
Number: Double Double
Number: Float Float
Binary byte[]
XML Element String
XML Attribute String
boolean Boolean
Group KxmException will be thrown
Date KxmDate
XML Qualified Name KxmQName
XML Duration KxmDuration
Raw Array Vector
If the field is raw array
Throws:
KxmException - will be thrown on an error.

getArrayLen

public int getArrayLen()
                throws KxmException
Returns the current number of elements in the array (a repeated group or a repeated XML element).
Throws:
KxmException - will be thrown on an error.

setArrayLen

public void setArrayLen(int l)
                 throws KxmException
Sets the new length for the array. This method can be used to reduce the number of array elements. The array grows automatically when you assign new elements.
Parameters:
l - new size of the array
Throws:
KxmException - will be thrown on an error.

at

public KxmField at(int index)
            throws KxmException
Returns an array element at the specified index. The index is zero-based. The array grows if the index is greater than the current upper bound.
Parameters:
index - Array element index.
Throws:
KxmException - will be thrown on an error.

applyFormat

public KxmField applyFormat(int format)
                     throws KxmException
Apply the specified format to the field.
Parameters:
format - New format. Possible values are:
  • KxmFieldFormat.NONE - no conversion.
  • KxmFieldFormat.BINARY_BASE64 - convert the field to the binary field having Base64 (RFC2045) text representation of data.
  • KxmFieldFormat.BINARY_HEX - convert the field to the binary field having hexadecimal text representation of data (two hexadecimal characters per byte).
Returns:
Result of the conversion.
Throws:
KxmException - will be thrown on an error.

applyFormat

public KxmField applyFormat(KxmFieldFormat format)
                     throws KxmException
Apply the specified format to the field.
Parameters:
format - Format to apply.
Returns:
Result of the conversion.
Throws:
KxmException - will be thrown on an error.

getNsPrefix

public java.lang.String getNsPrefix()
                             throws KxmException
Returns an XML namespace prefix of the field. If the field has no prefix, returns an empty string.
Throws:
KxmException - will be thrown on an error.

getNsUri

public java.lang.String getNsUri()
                          throws KxmException
Returns an XML namespace URI of the field. If the field does not belong to any XML namespace, returns an empty string.
Throws:
KxmException - will be thrown on an error.

getLocalPart

public java.lang.String getLocalPart()
                              throws KxmException
Returns a local part of the XML field name. If the field has no prefix, returns the same string as the getName() method does.
Throws:
KxmException - will be thrown on an error.

declareNs

public void declareNs(java.lang.String fieldName,
                      java.lang.String prefix,
                      java.lang.String uri)
               throws KxmException
Declares an XML namespace on the specified field. To declare a default XML namespace, specify an empty prefix. To put the field out of any XML namespace, specify an empty prefix and URI. To declare an XML namespace on the current field, specify an empty field name.
Parameters:
fieldName - Name of the target field.
prefix - XML namespace prefix.
uri - XML namespace URI.
Throws:
KxmException - will be thrown on an error.

getFlags

public int getFlags()
             throws KxmException
Returns field flags. It is a combination of the following constants:

setNil

public void setNil()
            throws KxmException
Marks the XML field as nil.
Throws:
KxmException - will be thrown on an error.

isNil

public boolean isNil()
              throws KxmException
Returns true if the XML field is nil.
Throws:
KxmException - will be thrown on an error.

setCharacterData

public void setCharacterData(java.lang.String data)
                      throws KxmException
Sets character data of the XML field.
Parameters:
data - XML character data.
Throws:
KxmException - will be thrown on an error.

getCharacterData

public java.lang.String getCharacterData()
                                  throws KxmException
Returns character data of the XML field.
Throws:
KxmException - will be thrown on an error.

toString

public java.lang.String toString()
Returns a string representation of the object.
Overrides:
toString in class java.lang.Object

getHandle

public long getHandle()

loadMessageApi

public static void loadMessageApi()