public class LayoutMessage extends Object implements Serializable, Cloneable
Layout
specification.Constructor and Description |
---|
LayoutMessage()
Constructs a new
LayoutMessage instance. |
LayoutMessage(Layout layout)
Constructs a new
LayoutMessage instance with layout . |
LayoutMessage(String text)
Constructs a new
LayoutMessage instance with text . |
LayoutMessage(String text,
Layout layout)
Constructs a new
LayoutMessage instance with arguments. |
Modifier and Type | Method and Description |
---|---|
LayoutMessage |
clone()
Returns a "deep" copy of this
LayoutMessage . |
void |
copyFrom(LayoutMessage source)
Copies all the properties of source into this
LayoutMessage . |
boolean |
exists(String fieldName)
Returns
true if the field indexed by fieldName exists in
the Layout of this message. |
Character |
getChar(String fieldName)
Returns the character value of the field identified by
fieldName . |
Character |
getChar(String fieldName,
int index)
Returns the character value of the field identified by
fieldName
and index . |
Date |
getDate(String fieldName)
Returns the date value of the field identified by
fieldName . |
Date |
getDate(String fieldName,
int index)
Returns the date value of the field identified by
fieldName and
index . |
static boolean |
getDefaultSignANSI()
Returns
true if, by default, numeric fields are stored using the
ANSI format. |
Double |
getDouble(String fieldName)
Returns the double value of the field identified by
fieldName . |
Double |
getDouble(String fieldName,
int index)
Returns the double value of the field identified by
fieldName and
index . |
LayoutField |
getField(String fieldName)
Returns the field identified by
fieldName . |
Integer |
getInteger(String fieldName)
Returns the integer value of the field identified by
fieldName . |
Integer |
getInteger(String fieldName,
int index)
Returns the integer value of the field identified by
fieldName
and index . |
Layout |
getLayout()
Returns the current layout of this message.
|
Long |
getLong(String fieldName)
Returns the long value of the field identified by
fieldName . |
Long |
getLong(String fieldName,
int index)
Returns the long value of the field identified by
fieldName and
index . |
BigDecimal |
getNumber(String fieldName)
Returns the decimal value of the field identified by
fieldName . |
BigDecimal |
getNumber(String fieldName,
int index)
Returns the decimal value of the field identified by
fieldName
and index . |
int |
getOccurs(String fieldName)
Returns the number of occurrences of the field identified by
fieldName . |
String |
getString(String fieldName)
Returns the string value of the field identified by
fieldName . |
String |
getString(String fieldName,
int index)
Returns the string value of the field identified by
fieldName and
index . |
String |
getSubstring(int start,
int end)
Returns a substring that begins at
start index and extends to
index end-1 . |
String |
getSubstring(int start,
int end,
boolean rtrim,
boolean nodata)
Returns a substring that begins at
start index and extends to
index end-1 . |
String |
getText()
Returns the text of this message with trailing spaces preserved.
|
String |
getText(boolean rtrim)
Returns the text of this message.
|
int |
getTextLen()
Returns the length of the text of this message.
|
String |
getTextTrim()
Returns the text of this message with trailing spaces are removed.
|
Object |
getValue(String fieldName)
Returns the object value of the field identified by
fieldName . |
Object |
getValue(String fieldName,
int index)
Returns the object value of the field identified by
fieldName and
index . |
void |
initFields()
Changes the value of each field of this message to its default value.
|
void |
initFields(LayoutMessage source)
Changes the value of each field of this message to the value of its
corresponding field in
source . |
boolean |
isNull(int start,
int end)
Returns
true if a substring is NULL. |
boolean |
isNull(String fieldName)
Returns
true if the value of the field identified by fieldName is NULL. |
boolean |
isNull(String fieldName,
int index)
Returns
true if the value of the field identified by fieldName and index is NULL. |
boolean |
isSignANSI()
Returns
true if numeric fields are stored using the ANSI format. |
void |
setChar(String fieldName,
Character value)
Changes the character value of the field identified by
fieldName . |
void |
setChar(String fieldName,
int index,
Character value)
Changes the character value of the field identified by
fieldName
and index . |
void |
setDate(String fieldName,
Date value)
Changes the date value of the field identified by
fieldName . |
void |
setDate(String fieldName,
int index,
Date value)
Changes the date value of the field identified by
fieldName and
index . |
static void |
setDefaultSignANSI(boolean signANSI)
Defines if, by default, numeric fields are stored using the ANSI format.
|
void |
setDouble(String fieldName,
Double value)
Changes the double value of the field identified by
fieldName . |
void |
setDouble(String fieldName,
int index,
Double value)
Changes the double value of the field identified by
fieldName and
index . |
void |
setInteger(String fieldName,
Integer value)
Changes the integer value of the field identified by
fieldName . |
void |
setInteger(String fieldName,
int index,
Integer value)
Changes the integer value of the field identified by
fieldName
and index . |
void |
setLayout(Layout layout)
Changes the layout of this message.
|
void |
setLong(String fieldName,
int index,
Long value)
Changes the long value of the field identified by
fieldName and
index . |
void |
setLong(String fieldName,
Long value)
Changes the long value of the field identified by
fieldName . |
void |
setNull(String fieldName)
Changes the value of the field identified by
fieldName to
NULL. |
void |
setNull(String fieldName,
int index)
Changes the value of the field identified by
fieldName and index to NULL. |
void |
setNumber(String fieldName,
BigDecimal value)
Changes the decimal value of the field identified by
fieldName . |
void |
setNumber(String fieldName,
int index,
BigDecimal value)
Changes the decimal value of the field identified by
fieldName
and index . |
void |
setSignANSI(boolean signANSI)
Defines whether numeric fields are stored in this message using the ANSI
format.
|
void |
setString(String fieldName,
int index,
String value)
Changes the string value of the field identified by
fieldName and
index . |
void |
setString(String fieldName,
String value)
Changes the string value of the field identified by
fieldName . |
void |
setSubstring(int start,
int end,
String value)
Replaces a substring with the supplied
value . |
void |
setText(String text)
Changes the text of this message.
|
void |
setValue(String fieldName,
int index,
Object value)
Changes the object value of the field identified by
fieldName and
index . |
void |
setValue(String fieldName,
Object value)
Changes the object value of the field identified by
fieldName . |
String |
toString()
Returns a string representation of this message.
|
String |
toXml()
Returns the XML string representation of the data stored in this message.
|
String |
toXml(boolean omitXmlDeclaration,
String encoding,
boolean indent,
int indentAmount)
Returns the XML string representation of the data stored in this message.
|
Layout |
verifyLayout(String name)
Verifies that the name of the layout of this message matches the supplied
name . |
public LayoutMessage()
LayoutMessage
instance.public LayoutMessage(String text)
LayoutMessage
instance with text
.text
- the initial text of the message.public LayoutMessage(Layout layout)
LayoutMessage
instance with layout
.layout
- the initial layout of the message.public final boolean isSignANSI()
true
if numeric fields are stored using the ANSI format.
Otherwise, numeric fields are stored using the TANDEM format.true
if numeric fields are stored using the ANSI format.public final void setSignANSI(boolean signANSI)
signANSI
is true
, 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 the setString
methods.
signANSI
- if true
numeric fields will be stored using
the ANSI mechanism. Otherwise, the TANDEM mechanism will be used.public static boolean getDefaultSignANSI()
true
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.
true
if, by default, numeric fields are stored using the
ANSI format. Otherwise, the TANDEM format is used.public static void setDefaultSignANSI(boolean signANSI)
signANSI
is true
, 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.
signANSI
- if true
numeric fields will be stored, by default,
using the ANSI format. Otherwise, the TANDEM format
will be used.public final int getTextLen()
public final String getText()
public final String getTextTrim()
public final String getText(boolean rtrim)
rtrim
is true
,
trailing spaces are removed.rtrim
- if true
trailing spaces are removed.getTextTrim()
,
getText()
public final void setText(String text)
text
- the new text of this message (can be null).public final String getSubstring(int start, int end)
start
index and extends to
index end-1
. Trailing spaces are removed. It returns null
if the first character of the substring is NO-DATA
(0x1A).start
- the start index of the substring.end
- the end index of the substring.null
.public final String getSubstring(int start, int end, boolean rtrim, boolean nodata)
start
index and extends to
index end-1
. If argument rtrim
is true
, trailing
spaces are removed. It returns null
if nodata
is true
and the first character of the substring is NO-DATA
(0x1A).
If nodata
is false
, the returned substring includes
NO-DATA
(0x1A) characters.start
- the start index of the substring.end
- the end index of the substring.rtrim
- if true
remove trailing spaces.nodata
- if true
check for NO-DATA.null
.public final void setSubstring(int start, int end, String value)
value
. The substring
begins at start
index and extends to index end-1
. If
value
is null
, the substring is filled with NO-DATA
(0x1A) characters. If value
is shorter than the
substring, the remaining space is filled with spaces. If value
is
too long, it is truncated.start
- the start index of the substring.end
- the end index of the substring.value
- the replacement value (can be null).public final Layout getLayout()
null
if
the message has no defined layout.null
.public final void setLayout(Layout layout)
layout
is null
,
the message will have no defined layout.layout
- new layout of this message (can be null).public final Layout verifyLayout(String name)
name
. This method throws IllegalArgumentException
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).
name
- the name of the required layout.null
).NullPointerException
- if name
is null
.IllegalArgumentException
- if the layout names do not match.public final void initFields()
getDefault
method. If this message has no defined
layout, nothing happens.public final void initFields(LayoutMessage source)
source
. Two fields are said to correspond
if they have the same name and type. If a field has no corresponding
field in source
, then its value is set to its default value. If
source
is null
or if source
has no defined
layout, then this methods operates as the initFields()
method.
If this message has no defined layout, nothing happens.source
- the message with corresponding fields (can be null).public final LayoutField getField(String fieldName)
fieldName
. It returns null
if this message does not have a defined layout, or if the field is
not defined in the layout.fieldName
- name of the layout field.fieldName
or null
.NullPointerException
- if fieldName
is null
.public final boolean exists(String fieldName)
true
if the field indexed by fieldName
exists in
the Layout
of this message. If returns false
if this
message does not have a defined layout, or if the field is not defined in
the layout.fieldName
- the name of the layout field.true
if the field is defined.NullPointerException
- if fieldName
is null
.public final int getOccurs(String fieldName)
fieldName
.fieldName
- name of the required field.NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.public final boolean isNull(int start, int end)
true
if a substring is NULL. A substring is
NULL if it's first character is NO-DATA
(0x1A). The
substring begins at start
index and extends to index end-1
.start
- the start index of the substring.end
- the end index of the substring.true
if the substring is NULL.public final boolean isNull(String fieldName)
true
if the value of the field identified by fieldName
is NULL. The value of the field is NULL if the
first character of it's substring is NO-DATA
(0x1A).fieldName
- name of the required field.true
if the specified field is NULL.NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.public final boolean isNull(String fieldName, int index)
true
if the value of the field identified by fieldName
and index
is NULL. The value is NULL if
the first character of it's substring is NO-DATA
(0x1A).fieldName
- name of the required field.index
- index of the required field occurrence.true
if the specified field is NULL.NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- if index
is out-of-bounds.public final void setNull(String fieldName)
fieldName
to
NULL. The value is set to NULL by replacing all characters
of the field's substring with NO-DATA
(0x1A).fieldName
- name of the required field.NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.public final void setNull(String fieldName, int index)
fieldName
and index
to NULL. The value is set to NULL by replacing all
characters of the field's substring with NO-DATA
(0x1A).fieldName
- name of the required field.index
- index of the required field occurrence.NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- if index
is out-of-bounds.public final String getString(String fieldName)
fieldName
. It
returns null
if the value of the field is NULL.fieldName
- name of the required field.null
.NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.ValueFormatException
- if the field record data is invalid.public final String getString(String fieldName, int index)
fieldName
and
index
. It returns null
if the value of the field is
NULL.
If the field is a FieldType.LIST
and index
is -1
,
it returns a string containing all the occurrences of the list.
fieldName
- name of the required field.index
- index of the required field occurrence.null
.NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- if index
is out-of-bounds.ValueFormatException
- if the field record data is invalid.public final void setString(String fieldName, String value)
fieldName
. If
value
is null
, the value of the field is set to
NULL.fieldName
- name of the required field.value
- the new string value of the field (can be null)..NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.ValueFormatException
- if value
has an invalid format.public final void setString(String fieldName, int index, String value)
fieldName
and
index
. If value
is null
then the value of the
field is set to NULL.
If the field is a FieldType.LIST
and index
is -1
,
the string containing all the occurrences of this list field is updated
with the supplied value
.
fieldName
- name of the required field.index
- index of the required field occurrence.value
- the new string value of the field (can be null)..NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- if index
is out-of-bounds.ValueFormatException
- if value
has an invalid format.public final Character getChar(String fieldName)
fieldName
.
It returns null
if the value of the field is NULL.fieldName
- name of the required field.null
.NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.ValueFormatException
- if the field record data is invalid.public final Character getChar(String fieldName, int index)
fieldName
and index
. It returns null
if the value of the field is
NULL.fieldName
- name of the required field.index
- index of the required field occurrence.null
.NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- if index
is out-of-bounds.ValueFormatException
- if the field record data is invalid.public final void setChar(String fieldName, Character value)
fieldName
.
If value
is null
the value of the field is set to
NULL.fieldName
- name of the required field.value
- the new character value of the field (can be null).NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.ValueFormatException
- if value
has an invalid format.public final void setChar(String fieldName, int index, Character value)
fieldName
and index
. If value
is null
the value of the
field is set to NULL.fieldName
- name of the required field.index
- index of the required field occurrence.value
- the new character value of the field (can be null).NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- if index
is out-of-bounds.ValueFormatException
- if value
has an invalid format.public final BigDecimal getNumber(String fieldName)
fieldName
.
It returns null
if the value of the field is NULL.fieldName
- name of the required field.null
.NullPointerException
- if fieldName
is null
.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 not
NUMERIC
or SIGNED
.public final BigDecimal getNumber(String fieldName, int index)
fieldName
and index
. It returns null
if the value of the field is
NULL.fieldName
- name of the required field.index
- index of the required field occurrence.null
.NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- if index
is out-of-bounds.ValueFormatException
- if the field record data is invalid.UnsupportedOperationException
- if the type of the field is not
NUMERIC
or SIGNED
.public final void setNumber(String fieldName, BigDecimal value)
fieldName
.
If value
is null
the value of the field is set to
NULL.fieldName
- name of the required field.value
- the new decimal value of the field (can be null).NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.UnsupportedOperationException
- if the type of the field is not
NUMERIC
or SIGNED
.public final void setNumber(String fieldName, int index, BigDecimal value)
fieldName
and index
. If value
is null
then the field's data
is set to NULL.fieldName
- name of the required field.index
- index of the required field occurrence.value
- the new decimal value of the field (can be null).NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- if index
is out-of-bounds.UnsupportedOperationException
- if the type of the field is not
NUMERIC
or SIGNED
.public final Double getDouble(String fieldName)
fieldName
. It
returns null
if the value of the field is NULL.fieldName
- name of the required field.null
.NullPointerException
- if fieldName
is null
.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 not
NUMERIC
or SIGNED
.public final Double getDouble(String fieldName, int index)
fieldName
and
index
. It returns null
if the value of the field is
NULL.fieldName
- name of the required field.index
- index of the required field occurrence.null
.NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- if index
is out-of-bounds.ValueFormatException
- if the field record data is invalid.UnsupportedOperationException
- if the type of the field is not
NUMERIC
or SIGNED
.public final void setDouble(String fieldName, Double value)
fieldName
. If
value
is null
, the value of the field is set to
NULL.fieldName
- name of the required field.value
- the new double value of the field (can be null).NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.UnsupportedOperationException
- if the type of the field is not
NUMERIC
or SIGNED
.public final void setDouble(String fieldName, int index, Double value)
fieldName
and
index
. If value
is null
, the value of the field
is set to NULL.fieldName
- name of the required field.index
- index of the required field occurrence.value
- the new double value of the field (can be null).NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- if index
is out-of-bounds.UnsupportedOperationException
- if the type of the field is not
NUMERIC
or SIGNED
.public final Integer getInteger(String fieldName)
fieldName
.
It returns null
if the value of the field is NULL.fieldName
- name of the required field.null
.NullPointerException
- if fieldName
is null
.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 not
NUMERIC
or SIGNED
.public final Integer getInteger(String fieldName, int index)
fieldName
and index
. It returns null
if the value of the field is
NULL.fieldName
- name of the required field.index
- index of the required field occurrence.null
.NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- if index
is out-of-bounds.ValueFormatException
- if the field record data is invalid.UnsupportedOperationException
- if the type of the field is not
NUMERIC
or SIGNED
.public final void setInteger(String fieldName, Integer value)
fieldName
.
If value
is null
, the value of the field is set to
NULL.fieldName
- name of the required field.value
- the new integer value of the field (can be null).NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.UnsupportedOperationException
- if the type of the field is not
NUMERIC
or SIGNED
.public final void setInteger(String fieldName, int index, Integer value)
fieldName
and index
. If value
is null
, the value of the
field is set to NULL.fieldName
- name of the required field.index
- index of the required field occurrence.value
- the new integer value of the field (can be null).NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- if index
is out-of-bounds.UnsupportedOperationException
- if the type of the field is not
NUMERIC
or SIGNED
.public final Long getLong(String fieldName)
fieldName
. It
returns null
if the value of the field is NULL.fieldName
- name of the required field.null
.NullPointerException
- if fieldName
is null
.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 not
NUMERIC
or SIGNED
.public final Long getLong(String fieldName, int index)
fieldName
and
index
. It returns null
if the value of the field is
NULL.fieldName
- name of the required field.index
- index of the required field occurrence.null
.NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- if index
is out-of-bounds.ValueFormatException
- if the field record data is invalid.UnsupportedOperationException
- if the type of the field is not
NUMERIC
or SIGNED
.public final void setLong(String fieldName, Long value)
fieldName
. If
value
is null
, the value of the field is set to
NULL.fieldName
- name of the required field.value
- the new long value of the field (can be null).NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.UnsupportedOperationException
- if the type of the field is not
NUMERIC
or SIGNED
.public final void setLong(String fieldName, int index, Long value)
fieldName
and
index
. If value
is null
, the value of the field
is set to NULL.fieldName
- name of the required field.index
- index of the required field occurrence.value
- the new long value of the field (can be null).NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- if index
is out-of-bounds.UnsupportedOperationException
- if the type of the field is not
NUMERIC
or SIGNED
.public final Date getDate(String fieldName)
fieldName
. It
returns null
if the value of the field is NULL.fieldName
- name of the required field.null
.NullPointerException
- if fieldName
is null
.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 not
DATE
.public final Date getDate(String fieldName, int index)
fieldName
and
index
. It returns null
if the value of the field is
NULL.fieldName
- name of the required field.index
- index of the required field occurrence.null
.NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- if index
is out-of-bounds.ValueFormatException
- if the field record data is invalid.UnsupportedOperationException
- if the type of the field is not
DATE
.public final void setDate(String fieldName, Date value)
fieldName
. If
value
is null
the value of the field is set to
NULL.fieldName
- name of the required field.value
- the new date value of the field (can be null).NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.UnsupportedOperationException
- if the type of the field is not
DATE
.public final void setDate(String fieldName, int index, Date value)
fieldName
and
index
. If value
is null
then the field's data is
set to NULL.fieldName
- name of the required field.index
- index of the required field occurrence.value
- the new date value of the field (can be null).NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- if index
is out-of-bounds.UnsupportedOperationException
- if the type of the field is not
DATE
.public final Object getValue(String fieldName)
fieldName
. It
returns null
if the value of the field is NULL.fieldName
- name of the required field.null
.NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.ValueFormatException
- if the field record data is invalid.public final Object getValue(String fieldName, int index)
fieldName
and
index
. It returns null
if the value of the field is
NULL.fieldName
- name of the required field.index
- index of the required field occurrence.null
.NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- if index
is out-of-bounds.ValueFormatException
- if the field record data is invalid.public final void setValue(String fieldName, Object value)
fieldName
. If
value
is null
the value of the field is set to
NULL.fieldName
- name of the required field.value
- the new object value of the field (can be null).NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.ValueFormatException
- if supplied value
is invalid.public final void setValue(String fieldName, int index, Object value)
fieldName
and
index
. If value
is null
then the field's data is
set to NULL.fieldName
- name of the required field.index
- index of the required field occurrence.value
- the new object value of the field (can be null).NullPointerException
- if fieldName
is null
.IllegalStateException
- if no layout is defined.IllegalArgumentException
- if the field does not exist.IndexOutOfBoundsException
- if index
is out-of-bounds.ValueFormatException
- if supplied value
is invalid.public final String toXml(boolean omitXmlDeclaration, String encoding, boolean indent, int indentAmount)
omitXmlDeclaration
is true
, the XML declaration header
is not included. The encoding
argument specifies the character
encoding included in the XML declaration header (for example "UTF-8"
or "ISO-8859-1"
). If indent
is true
, the
resulting XML will have whitespace included to indent the tree. The
indentation amount is specified with indentAmount
.
Consider, for example, a layout named CONTACT
with four fields
called SERVICE
, GROUP
, USERNAME
and USERCODE
. The string returned by this method for a message with layout
CONTACT
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>
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.NullPointerException
- if encoding
is null
.IllegalArgumentException
- if indentAmount
is negative.public final String toXml()
This method has the same effect as calling toXml(true, "UTF-8", false, 0)
.
public String toString()
public final void copyFrom(LayoutMessage source)
LayoutMessage
. The
values of all properties in this LayoutMessage
are replaced by
copies of the values of corresponding source properties.source
- the source LayoutMessage
to be copied.NullPointerException
- if source
is null
.public LayoutMessage clone()
LayoutMessage
.Copyright © OBCOM INGENIERIA S.A. (Chile). All Rights Reserved.