Class LayoutMessage
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
NetServerMessage
Layout
specification.- See Also:
-
Constructor Summary
ConstructorDescriptionConstructs a newLayoutMessage
instance.LayoutMessage
(Layout layout) Constructs a newLayoutMessage
instance withlayout
.LayoutMessage
(String text) Constructs a newLayoutMessage
instance withtext
.LayoutMessage
(String text, Layout layout) Constructs a newLayoutMessage
instance with arguments. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a "deep" copy of thisLayoutMessage
.final void
copyFrom
(LayoutMessage source) Copies all the properties of source into thisLayoutMessage
.final boolean
Returnstrue
if the field indexed byfieldName
exists in theLayout
of this message.final Character
Returns the character value of the field identified byfieldName
.final Character
Returns the character value of the field identified byfieldName
andindex
.final Date
Returns the date value of the field identified byfieldName
.final Date
Returns the date value of the field identified byfieldName
andindex
.static boolean
Returnstrue
if, by default, numeric fields are stored using the ANSI format.final Double
Returns the double value of the field identified byfieldName
.final Double
Returns the double value of the field identified byfieldName
andindex
.final LayoutField
Returns the field identified byfieldName
.final Integer
getInteger
(String fieldName) Returns the integer value of the field identified byfieldName
.final Integer
getInteger
(String fieldName, int index) Returns the integer value of the field identified byfieldName
andindex
.final Layout
Returns the current layout of this message.final Long
Returns the long value of the field identified byfieldName
.final Long
Returns the long value of the field identified byfieldName
andindex
.final BigDecimal
Returns the decimal value of the field identified byfieldName
.final BigDecimal
Returns the decimal value of the field identified byfieldName
andindex
.final int
Returns the number of occurrences of the field identified byfieldName
.final String
Returns the string value of the field identified byfieldName
.final String
Returns the string value of the field identified byfieldName
andindex
.final String
getSubstring
(int start, int end) Returns a substring that begins atstart
index and extends to indexend-1
.final String
getSubstring
(int start, int end, boolean rtrim, boolean nodata) Returns a substring that begins atstart
index and extends to indexend-1
.final String
getText()
Returns the text of this message with trailing spaces preserved.final String
getText
(boolean rtrim) Returns the text of this message.final int
Returns the length of the text of this message.final String
Returns the text of this message with trailing spaces are removed.final Object
Returns the object value of the field identified byfieldName
.final Object
Returns the object value of the field identified byfieldName
andindex
.final void
Changes the value of each field of this message to its default value.final void
initFields
(LayoutMessage source) Changes the value of each field of this message to the value of its corresponding field insource
.final boolean
isNull
(int start, int end) Returnstrue
if a substring is NULL.final boolean
Returnstrue
if the value of the field identified byfieldName
is NULL.final boolean
Returnstrue
if the value of the field identified byfieldName
andindex
is NULL.final boolean
Returnstrue
if numeric fields are stored using the ANSI format.final void
Changes the character value of the field identified byfieldName
andindex
.final void
Changes the character value of the field identified byfieldName
.final void
Changes the date value of the field identified byfieldName
andindex
.final void
Changes the date value of the field identified byfieldName
.static void
setDefaultSignANSI
(boolean signANSI) Defines if, by default, numeric fields are stored using the ANSI format.final void
Changes the double value of the field identified byfieldName
andindex
.final void
Changes the double value of the field identified byfieldName
.final void
setInteger
(String fieldName, int index, Integer value) Changes the integer value of the field identified byfieldName
andindex
.final void
setInteger
(String fieldName, Integer value) Changes the integer value of the field identified byfieldName
.final void
Changes the layout of this message.final void
Changes the long value of the field identified byfieldName
andindex
.final void
Changes the long value of the field identified byfieldName
.final void
Changes the value of the field identified byfieldName
to NULL.final void
Changes the value of the field identified byfieldName
andindex
to NULL.final void
setNumber
(String fieldName, int index, BigDecimal value) Changes the decimal value of the field identified byfieldName
andindex
.final void
setNumber
(String fieldName, BigDecimal value) Changes the decimal value of the field identified byfieldName
.final void
setSignANSI
(boolean signANSI) Defines whether numeric fields are stored in this message using the ANSI format.final void
Changes the string value of the field identified byfieldName
andindex
.final void
Changes the string value of the field identified byfieldName
.final void
setSubstring
(int start, int end, String value) Replaces a substring with the suppliedvalue
.final void
Changes the text of this message.final void
Changes the object value of the field identified byfieldName
andindex
.final void
Changes the object value of the field identified byfieldName
.toString()
Returns a string representation of this message.final String
toXml()
Returns the XML string representation of the data stored in this message.final String
Returns the XML string representation of the data stored in this message.final Layout
verifyLayout
(String name) Verifies that the name of the layout of this message matches the suppliedname
.
-
Constructor Details
-
LayoutMessage
public LayoutMessage()Constructs a newLayoutMessage
instance. -
LayoutMessage
Constructs a newLayoutMessage
instance withtext
.- Parameters:
text
- the initial text of the message.
-
LayoutMessage
Constructs a newLayoutMessage
instance withlayout
.- Parameters:
layout
- the initial layout of the message.
-
LayoutMessage
Constructs a newLayoutMessage
instance with arguments.- Parameters:
text
- the initial text of the message.layout
- the initial layout of the message.
-
-
Method Details
-
isSignANSI
public final boolean isSignANSI()Returnstrue
if numeric fields are stored using the ANSI format. Otherwise, numeric fields are stored using the TANDEM format.- Returns:
true
if numeric fields are stored using the ANSI format.
-
setSignANSI
public final void setSignANSI(boolean signANSI) Defines whether numeric fields are stored in this message using the ANSI format. IfsignANSI
istrue
, numeric fields will be stored using the ANSI format. Otherwise, numeric fields will be stored using the TANDEM format.Note: this method does not change the representation of the numeric fields that are currently stored in this message. It defines how numeric fields will be stored in future calls to the
setNumber
or thesetString
methods.- Parameters:
signANSI
- iftrue
numeric fields will be stored using the ANSI mechanism. Otherwise, the TANDEM mechanism will be used.
-
getDefaultSignANSI
public static boolean getDefaultSignANSI()Returnstrue
if, by default, numeric fields are stored using the ANSI format. Otherwise, numeric fields are stored using the TANDEM format.When a new message is created, it uses this global value to initialize its behavior. This default behavior can be changed on individual messages using the
setSignANSI
method.- Returns:
true
if, by default, numeric fields are stored using the ANSI format. Otherwise, the TANDEM format is used.
-
setDefaultSignANSI
public static void setDefaultSignANSI(boolean signANSI) Defines if, by default, numeric fields are stored using the ANSI format. IfsignANSI
istrue
, numeric fields will be stored using the ANSI format. Otherwise, numeric fields will be stored using the TANDEM mechanism.When a new message is created, it uses this global value to initialize its behavior. This default behavior can be changed on individual messages using the
setSignANSI
method.- Parameters:
signANSI
- iftrue
numeric fields will be stored, by default, using the ANSI format. Otherwise, the TANDEM format will be used.
-
getTextLen
public final int getTextLen()Returns the length of the text of this message.- Returns:
- the length of the text of this message.
-
getText
Returns the text of this message with trailing spaces preserved.- Returns:
- the text of this message with trailing spaces preserved.
-
getTextTrim
Returns the text of this message with trailing spaces are removed.- Returns:
- the text of this message with trailing spaces are removed.
-
getText
Returns the text of this message. Ifrtrim
istrue
, trailing spaces are removed.- Parameters:
rtrim
- iftrue
trailing spaces are removed.- Returns:
- the text of this message.
- See Also:
-
setText
Changes the text of this message.- Parameters:
text
- the new text of this message (can be null).
-
getSubstring
Returns a substring that begins atstart
index and extends to indexend-1
. Trailing spaces are removed. It returnsnull
if the first character of the substring isNO-DATA
(0x1A).- Parameters:
start
- the start index of the substring.end
- the end index of the substring.- Returns:
- the requiered substring or
null
.
-
getSubstring
Returns a substring that begins atstart
index and extends to indexend-1
. If argumentrtrim
istrue
, trailing spaces are removed. It returnsnull
ifnodata
istrue
and the first character of the substring isNO-DATA
(0x1A). Ifnodata
isfalse
, the returned substring includesNO-DATA
(0x1A) characters.- Parameters:
start
- the start index of the substring.end
- the end index of the substring.rtrim
- iftrue
remove trailing spaces.nodata
- iftrue
check for NO-DATA.- Returns:
- the requiered substring or
null
.
-
setSubstring
Replaces a substring with the suppliedvalue
. The substring begins atstart
index and extends to indexend-1
. Ifvalue
isnull
, the substring is filled withNO-DATA
(0x1A) characters. Ifvalue
is shorter than the substring, the remaining space is filled with spaces. Ifvalue
is too long, it is truncated.- Parameters:
start
- the start index of the substring.end
- the end index of the substring.value
- the replacement value (can be null).
-
getLayout
Returns the current layout of this message. It returnsnull
if the message has no defined layout.- Returns:
- the layout of this message or
null
.
-
setLayout
Changes the layout of this message. Iflayout
isnull
, the message will have no defined layout.- Parameters:
layout
- new layout of this message (can be null).
-
verifyLayout
Verifies that the name of the layout of this message matches the suppliedname
. This method throwsIllegalArgumentException
if this message has no defined layout, or if the layout names do not match.This convenience method is normally used in the implementation of methods that process transaction requests whose data must be sent from a client application with a particular structure (or layout).
- Parameters:
name
- the name of the required layout.- Returns:
- the verified layout of this message (never
null
). - Throws:
NullPointerException
- ifname
isnull
.IllegalArgumentException
- if the layout names do not match.
-
initFields
public final void initFields()Changes the value of each field of this message to its default value. The default value of a layout field is obtained using thegetDefault
method. If this message has no defined layout, nothing happens. -
initFields
Changes the value of each field of this message to the value of its corresponding field insource
. Two fields are said to correspond if they have the same name and type. If a field has no corresponding field insource
, then its value is set to its default value. Ifsource
isnull
or ifsource
has no defined layout, then this methods operates as theinitFields()
method. If this message has no defined layout, nothing happens.- Parameters:
source
- the message with corresponding fields (can be null).
-
getField
Returns the field identified byfieldName
. It returnsnull
if this message does not have a defined layout, or if the field is not defined in the layout.- Parameters:
fieldName
- name of the layout field.- Returns:
- the field identified by
fieldName
ornull
. - Throws:
NullPointerException
- iffieldName
isnull
.
-
exists
Returnstrue
if the field indexed byfieldName
exists in theLayout
of this message. If returnsfalse
if this message does not have a defined layout, or if the field is not defined in the layout.- Parameters:
fieldName
- the name of the layout field.- Returns:
true
if the field is defined.- Throws:
NullPointerException
- iffieldName
isnull
.
-
getOccurs
Returns the number of occurrences of the field identified byfieldName
.- Parameters:
fieldName
- name of the required field.- Returns:
- the number of occurrences of the specified field.
- Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.
-
isNull
public final boolean isNull(int start, int end) Returnstrue
if a substring is NULL. A substring is NULL if it's first character isNO-DATA
(0x1A). The substring begins atstart
index and extends to indexend-1
.- Parameters:
start
- the start index of the substring.end
- the end index of the substring.- Returns:
true
if the substring is NULL.
-
isNull
Returnstrue
if the value of the field identified byfieldName
is NULL. The value of the field is NULL if the first character of it's substring isNO-DATA
(0x1A).- Parameters:
fieldName
- name of the required field.- Returns:
true
if the specified field is NULL.- Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.
-
isNull
Returnstrue
if the value of the field identified byfieldName
andindex
is NULL. The value is NULL if the first character of it's substring isNO-DATA
(0x1A).- Parameters:
fieldName
- name of the required field.index
- index of the required field occurrence.- Returns:
true
if the specified field is NULL.- Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- ifindex
is out-of-bounds.
-
setNull
Changes the value of the field identified byfieldName
to NULL. The value is set to NULL by replacing all characters of the field's substring withNO-DATA
(0x1A).- Parameters:
fieldName
- name of the required field.- Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.
-
setNull
Changes the value of the field identified byfieldName
andindex
to NULL. The value is set to NULL by replacing all characters of the field's substring withNO-DATA
(0x1A).- Parameters:
fieldName
- name of the required field.index
- index of the required field occurrence.- Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- ifindex
is out-of-bounds.
-
getString
Returns the string value of the field identified byfieldName
. It returnsnull
if the value of the field is NULL.- Parameters:
fieldName
- name of the required field.- Returns:
- the string value of the specified field or
null
. - Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.ValueFormatException
- if the field record data is invalid.
-
getString
Returns the string value of the field identified byfieldName
andindex
. It returnsnull
if the value of the field is NULL.If the field is a
FieldType.LIST
andindex
is-1
, it returns a string containing all the occurrences of the list.- Parameters:
fieldName
- name of the required field.index
- index of the required field occurrence.- Returns:
- the string value of the specified field or
null
. - Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- ifindex
is out-of-bounds.ValueFormatException
- if the field record data is invalid.
-
setString
Changes the string value of the field identified byfieldName
. Ifvalue
isnull
, the value of the field is set to NULL.- Parameters:
fieldName
- name of the required field.value
- the new string value of the field (can be null)..- Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.ValueFormatException
- ifvalue
has an invalid format.
-
setString
Changes the string value of the field identified byfieldName
andindex
. Ifvalue
isnull
then the value of the field is set to NULL.If the field is a
FieldType.LIST
andindex
is-1
, the string containing all the occurrences of this list field is updated with the suppliedvalue
.- Parameters:
fieldName
- name of the required field.index
- index of the required field occurrence.value
- the new string value of the field (can be null)..- Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- ifindex
is out-of-bounds.ValueFormatException
- ifvalue
has an invalid format.
-
getChar
Returns the character value of the field identified byfieldName
. It returnsnull
if the value of the field is NULL.- Parameters:
fieldName
- name of the required field.- Returns:
- the character value of the specified field or
null
. - Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.ValueFormatException
- if the field record data is invalid.
-
getChar
Returns the character value of the field identified byfieldName
andindex
. It returnsnull
if the value of the field is NULL.- Parameters:
fieldName
- name of the required field.index
- index of the required field occurrence.- Returns:
- the character value of the specified field or
null
. - Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- ifindex
is out-of-bounds.ValueFormatException
- if the field record data is invalid.
-
setChar
Changes the character value of the field identified byfieldName
. Ifvalue
isnull
the value of the field is set to NULL.- Parameters:
fieldName
- name of the required field.value
- the new character value of the field (can be null).- Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.ValueFormatException
- ifvalue
has an invalid format.
-
setChar
Changes the character value of the field identified byfieldName
andindex
. Ifvalue
isnull
the value of the field is set to NULL.- Parameters:
fieldName
- name of the required field.index
- index of the required field occurrence.value
- the new character value of the field (can be null).- Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- ifindex
is out-of-bounds.ValueFormatException
- ifvalue
has an invalid format.
-
getNumber
Returns the decimal value of the field identified byfieldName
. It returnsnull
if the value of the field is NULL.- Parameters:
fieldName
- name of the required field.- Returns:
- the decimal value of the specified field or
null
. - Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.ValueFormatException
- if the field record data is invalid.UnsupportedOperationException
- if the type of the field is notNUMERIC
orSIGNED
.
-
getNumber
Returns the decimal value of the field identified byfieldName
andindex
. It returnsnull
if the value of the field is NULL.- Parameters:
fieldName
- name of the required field.index
- index of the required field occurrence.- Returns:
- the decimal value of the specified field or
null
. - Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- ifindex
is out-of-bounds.ValueFormatException
- if the field record data is invalid.UnsupportedOperationException
- if the type of the field is notNUMERIC
orSIGNED
.
-
setNumber
Changes the decimal value of the field identified byfieldName
. Ifvalue
isnull
the value of the field is set to NULL.- Parameters:
fieldName
- name of the required field.value
- the new decimal value of the field (can be null).- Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.UnsupportedOperationException
- if the type of the field is notNUMERIC
orSIGNED
.
-
setNumber
Changes the decimal value of the field identified byfieldName
andindex
. Ifvalue
isnull
then the field's data is set to NULL.- Parameters:
fieldName
- name of the required field.index
- index of the required field occurrence.value
- the new decimal value of the field (can be null).- Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- ifindex
is out-of-bounds.UnsupportedOperationException
- if the type of the field is notNUMERIC
orSIGNED
.
-
getDouble
Returns the double value of the field identified byfieldName
. It returnsnull
if the value of the field is NULL.- Parameters:
fieldName
- name of the required field.- Returns:
- the double value of the specified field or
null
. - Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.ValueFormatException
- if the field record data is invalid.UnsupportedOperationException
- if the type of the field is notNUMERIC
orSIGNED
.
-
getDouble
Returns the double value of the field identified byfieldName
andindex
. It returnsnull
if the value of the field is NULL.- Parameters:
fieldName
- name of the required field.index
- index of the required field occurrence.- Returns:
- the double value of the specified field or
null
. - Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- ifindex
is out-of-bounds.ValueFormatException
- if the field record data is invalid.UnsupportedOperationException
- if the type of the field is notNUMERIC
orSIGNED
.
-
setDouble
Changes the double value of the field identified byfieldName
. Ifvalue
isnull
, the value of the field is set to NULL.- Parameters:
fieldName
- name of the required field.value
- the new double value of the field (can be null).- Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.UnsupportedOperationException
- if the type of the field is notNUMERIC
orSIGNED
.
-
setDouble
Changes the double value of the field identified byfieldName
andindex
. Ifvalue
isnull
, the value of the field is set to NULL.- Parameters:
fieldName
- name of the required field.index
- index of the required field occurrence.value
- the new double value of the field (can be null).- Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- ifindex
is out-of-bounds.UnsupportedOperationException
- if the type of the field is notNUMERIC
orSIGNED
.
-
getInteger
Returns the integer value of the field identified byfieldName
. It returnsnull
if the value of the field is NULL.- Parameters:
fieldName
- name of the required field.- Returns:
- the integer value of the specified field or
null
. - Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.ValueFormatException
- if the field record data is invalid.UnsupportedOperationException
- if the type of the field is notNUMERIC
orSIGNED
.
-
getInteger
Returns the integer value of the field identified byfieldName
andindex
. It returnsnull
if the value of the field is NULL.- Parameters:
fieldName
- name of the required field.index
- index of the required field occurrence.- Returns:
- the integer value of the specified field or
null
. - Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- ifindex
is out-of-bounds.ValueFormatException
- if the field record data is invalid.UnsupportedOperationException
- if the type of the field is notNUMERIC
orSIGNED
.
-
setInteger
Changes the integer value of the field identified byfieldName
. Ifvalue
isnull
, the value of the field is set to NULL.- Parameters:
fieldName
- name of the required field.value
- the new integer value of the field (can be null).- Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.UnsupportedOperationException
- if the type of the field is notNUMERIC
orSIGNED
.
-
setInteger
Changes the integer value of the field identified byfieldName
andindex
. Ifvalue
isnull
, the value of the field is set to NULL.- Parameters:
fieldName
- name of the required field.index
- index of the required field occurrence.value
- the new integer value of the field (can be null).- Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- ifindex
is out-of-bounds.UnsupportedOperationException
- if the type of the field is notNUMERIC
orSIGNED
.
-
getLong
Returns the long value of the field identified byfieldName
. It returnsnull
if the value of the field is NULL.- Parameters:
fieldName
- name of the required field.- Returns:
- the long value of the specified field or
null
. - Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.ValueFormatException
- if the field record data is invalid.UnsupportedOperationException
- if the type of the field is notNUMERIC
orSIGNED
.
-
getLong
Returns the long value of the field identified byfieldName
andindex
. It returnsnull
if the value of the field is NULL.- Parameters:
fieldName
- name of the required field.index
- index of the required field occurrence.- Returns:
- the long value of the specified field or
null
. - Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- ifindex
is out-of-bounds.ValueFormatException
- if the field record data is invalid.UnsupportedOperationException
- if the type of the field is notNUMERIC
orSIGNED
.
-
setLong
Changes the long value of the field identified byfieldName
. Ifvalue
isnull
, the value of the field is set to NULL.- Parameters:
fieldName
- name of the required field.value
- the new long value of the field (can be null).- Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.UnsupportedOperationException
- if the type of the field is notNUMERIC
orSIGNED
.
-
setLong
Changes the long value of the field identified byfieldName
andindex
. Ifvalue
isnull
, the value of the field is set to NULL.- Parameters:
fieldName
- name of the required field.index
- index of the required field occurrence.value
- the new long value of the field (can be null).- Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- ifindex
is out-of-bounds.UnsupportedOperationException
- if the type of the field is notNUMERIC
orSIGNED
.
-
getDate
Returns the date value of the field identified byfieldName
. It returnsnull
if the value of the field is NULL.- Parameters:
fieldName
- name of the required field.- Returns:
- the date value of the specified field or
null
. - Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.ValueFormatException
- if the field record data is invalid.UnsupportedOperationException
- if the type of the field is notDATE
.
-
getDate
Returns the date value of the field identified byfieldName
andindex
. It returnsnull
if the value of the field is NULL.- Parameters:
fieldName
- name of the required field.index
- index of the required field occurrence.- Returns:
- the date value of the specified field or
null
. - Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- ifindex
is out-of-bounds.ValueFormatException
- if the field record data is invalid.UnsupportedOperationException
- if the type of the field is notDATE
.
-
setDate
Changes the date value of the field identified byfieldName
. Ifvalue
isnull
the value of the field is set to NULL.- Parameters:
fieldName
- name of the required field.value
- the new date value of the field (can be null).- Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.UnsupportedOperationException
- if the type of the field is notDATE
.
-
setDate
Changes the date value of the field identified byfieldName
andindex
. Ifvalue
isnull
then the field's data is set to NULL.- Parameters:
fieldName
- name of the required field.index
- index of the required field occurrence.value
- the new date value of the field (can be null).- Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- ifindex
is out-of-bounds.UnsupportedOperationException
- if the type of the field is notDATE
.
-
getValue
Returns the object value of the field identified byfieldName
. It returnsnull
if the value of the field is NULL.- Parameters:
fieldName
- name of the required field.- Returns:
- the object value of the specified field or
null
. - Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.ValueFormatException
- if the field record data is invalid.
-
getValue
Returns the object value of the field identified byfieldName
andindex
. It returnsnull
if the value of the field is NULL.- Parameters:
fieldName
- name of the required field.index
- index of the required field occurrence.- Returns:
- the object value of the specified field or
null
. - Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- ifindex
is out-of-bounds.ValueFormatException
- if the field record data is invalid.
-
setValue
Changes the object value of the field identified byfieldName
. Ifvalue
isnull
the value of the field is set to NULL.- Parameters:
fieldName
- name of the required field.value
- the new object value of the field (can be null).- Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.ValueFormatException
- if suppliedvalue
is invalid.
-
setValue
Changes the object value of the field identified byfieldName
andindex
. Ifvalue
isnull
then the field's data is set to NULL.- Parameters:
fieldName
- name of the required field.index
- index of the required field occurrence.value
- the new object value of the field (can be null).- Throws:
NullPointerException
- iffieldName
isnull
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- ifindex
is out-of-bounds.ValueFormatException
- if suppliedvalue
is invalid.
-
toXml
public final String toXml(boolean omitXmlDeclaration, String encoding, boolean indent, int indentAmount) Returns the XML string representation of the data stored in this message. IfomitXmlDeclaration
istrue
, the XML declaration header is not included. Theencoding
argument specifies the character encoding included in the XML declaration header (for example"UTF-8"
or"ISO-8859-1"
). Ifindent
istrue
, the resulting XML will have whitespace included to indent the tree. The indentation amount is specified withindentAmount
.Consider, for example, a layout named
CONTACT
with four fields calledSERVICE
,GROUP
,USERNAME
andUSERCODE
. The string returned by this method for a message with layoutCONTACT
would be smae as the following indented XML tree, except for the values of the fields which are shown in italics:<CONTACT> <SERVICE>service</SERVICE> <GROUP>group</GROUP> <USERNAME>user</USERNAME> <USERCODE>12345</USERCODE> </CONTACT>
- Parameters:
omitXmlDeclaration
- specifies whether to omit the XML declaration.encoding
- the character encoding included in the XML declaration.indent
- specifies whether to indent the XML representation.indentAmount
- specifies the indentation amount.- Returns:
- the XML representation of the data stored in this message.
- Throws:
NullPointerException
- ifencoding
isnull
.IllegalArgumentException
- ifindentAmount
is negative.
-
toXml
Returns the XML string representation of the data stored in this message.This method has the same effect as calling
toXml(true, "UTF-8", false, 0)
.- Returns:
- the XML representation of the data stored in this message.
-
toString
Returns a string representation of this message. -
copyFrom
Copies all the properties of source into thisLayoutMessage
. The values of all properties in thisLayoutMessage
are replaced by copies of the values of corresponding source properties.- Parameters:
source
- the sourceLayoutMessage
to be copied.- Throws:
NullPointerException
- ifsource
isnull
.
-
clone
Returns a "deep" copy of thisLayoutMessage
.
-