Class LayoutMessage
- All Implemented Interfaces:
Serializable, Cloneable
Layout specification.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newLayoutMessageinstance.LayoutMessage(Layout layout) Constructs a newLayoutMessageinstance withlayout.LayoutMessage(String text) Constructs a newLayoutMessageinstance withtext.LayoutMessage(String text, Layout layout) Constructs a newLayoutMessageinstance with arguments. -
Method Summary
Modifier and TypeMethodDescriptionclone()Returns a "deep" copy of thisLayoutMessage.final voidcopyFrom(LayoutMessage source) Copies all the properties of source into thisLayoutMessage.final booleanReturnstrueif the field indexed byfieldNameexists in theLayoutof this message.final CharacterReturns the character value of the field identified byfieldName.final CharacterReturns the character value of the field identified byfieldNameandindex.final DateReturns the date value of the field identified byfieldName.final DateReturns the date value of the field identified byfieldNameandindex.static booleanReturnstrueif, by default, numeric fields are stored using the ANSI format.static booleanReturnstrueif, by default, message editing is strict.final DoubleReturns the double value of the field identified byfieldName.final DoubleReturns the double value of the field identified byfieldNameandindex.final LayoutFieldReturns the field identified byfieldName.final IntegergetInteger(String fieldName) Returns the integer value of the field identified byfieldName.final IntegergetInteger(String fieldName, int index) Returns the integer value of the field identified byfieldNameandindex.final LayoutReturns the current layout of this message.final LongReturns the long value of the field identified byfieldName.final LongReturns the long value of the field identified byfieldNameandindex.final BigDecimalReturns the decimal value of the field identified byfieldName.final BigDecimalReturns the decimal value of the field identified byfieldNameandindex.final intReturns the number of occurrences of the field identified byfieldName.final StringgetSequence(String fieldName) Returns the unformatted character sequence of the field identified byfieldName.final StringgetSequence(String fieldName, int index) Returns the unformatted character sequence of the field identified byfieldNameandindex.final StringReturns the string value of the field identified byfieldName.final StringReturns the string value of the field identified byfieldNameandindex.final StringgetText()Returns the text of this message.final StringReturns the text of this message with trailing space characters removed.final voidChanges the value of each field of this message to its default value.final voidinitFields(LayoutMessage source) Changes the value of each field of this message to the value of its corresponding field insource.final booleanisNull(int start, int end) Returnstrueif a substring is NULL.final booleanReturnstrueif the value of the field identified byfieldNameis NULL.final booleanReturnstrueif the value of the field identified byfieldNameandindexis NULL.final booleanReturnstrueif numeric fields are stored using the ANSI format.final booleanisStrict()Returnstrueif message editing is strict.final voidReplaces a substring with the supplied stringvalue.final voidChanges the character value of the field identified byfieldNameandindex.final voidChanges the character value of the field identified byfieldName.final voidChanges the date value of the field identified byfieldNameandindex.final voidChanges the date value of the field identified byfieldName.static voidsetDefaultSignANSI(boolean signANSI) Defines if, by default, numeric fields are stored using the ANSI format.static voidsetDefaultStrict(boolean strict) Defines if, by default, message editing is strict.final voidChanges the double value of the field identified byfieldNameandindex.final voidChanges the double value of the field identified byfieldName.final voidsetInteger(String fieldName, int index, Integer value) Changes the integer value of the field identified byfieldNameandindex.final voidsetInteger(String fieldName, Integer value) Changes the integer value of the field identified byfieldName.final voidChanges the layout of this message.final voidChanges the long value of the field identified byfieldNameandindex.final voidChanges the long value of the field identified byfieldName.final voidChanges the value of the field identified byfieldNameto NULL.final voidChanges the value of the field identified byfieldNameandindexto NULL.final voidsetNumber(String fieldName, int index, BigDecimal value) Changes the decimal value of the field identified byfieldNameandindex.final voidsetNumber(String fieldName, BigDecimal value) Changes the decimal value of the field identified byfieldName.final voidsetSequence(String fieldName, int index, String value) Changes the unformatted character sequence of the field identified byfieldNameandindex.final voidsetSequence(String fieldName, String value) Changes the unformatted character sequence of the field identified byfieldName.final voidsetSignANSI(boolean signANSI) Defines whether numeric fields are stored in this message using the ANSI format.final voidsetStrict(boolean strict) Defines whether message editing is strict.final voidChanges the string value of the field identified byfieldNameandindex.final voidChanges the string value of the field identified byfieldName.final voidChanges the text of this message.final Stringsubstring(int start, int end) Returns a substring that begins at the specifiedstartindex and extends to indexend-1.final MessageReturns aMessagewith the text and layout name of this message.toString()Returns a string representation of this message.final StringtoXml()Returns the XML string representation of the data stored in this message.final StringReturns the XML string representation of the data stored in this message.final LayoutverifyLayout(String layoutName) Verifies that the name of the layout of this message matches the suppliedlayoutName.
-
Constructor Details
-
LayoutMessage
public LayoutMessage()Constructs a newLayoutMessageinstance. -
LayoutMessage
Constructs a newLayoutMessageinstance withtext.- Parameters:
text- the initial text of the message.
-
LayoutMessage
Constructs a newLayoutMessageinstance withlayout.- Parameters:
layout- the initial layout of the message.
-
LayoutMessage
-
-
Method Details
-
isStrict
public final boolean isStrict()Returnstrueif message editing is strict. See methodsetStrictfor further details.- Returns:
trueif message editing is strict.- See Also:
-
setStrict
public final void setStrict(boolean strict) Defines whether message editing is strict. If message editing is strict, any attempt to assign an invalid field value generates (throws) an exception. If message editing is not strict, certain invalid field values are permitted as described in the following table:Invalid Field Value Action Taken RUT value with incorrect parity character The RUT value is stored as supplied Numeric value longer than the length of the field The numeric value is silently truncated on the left Text value longer than the length of the field The text value is silently truncated on the right Negative value applied to an unsigned numeric field The numeric value is stored ignoring its sign - Parameters:
strict- iftruethe message will be strict.
-
getDefaultStrict
public static boolean getDefaultStrict()Returnstrueif, by default, message editing is strict. If message editing is strict, any attempt to assign an invalid field value generates (throws) an exception. If message editing is not strict, certain invalid field values are permitted.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
setStrictmethod.- Returns:
trueif, by default, message editing is strict.- See Also:
-
setDefaultStrict
public static void setDefaultStrict(boolean strict) Defines if, by default, message editing is strict. If message editing is strict, any attempt to assign an invalid field value generates (throws) an exception. If message editing is not strict, certain invalid field values are permitted.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
setStrictmethod.- Parameters:
strict- iftruemessage editing is strict.- See Also:
-
isSignANSI
public final boolean isSignANSI()Returnstrueif numeric fields are stored using the ANSI format. Otherwise, numeric fields are stored using the TANDEM format.- Returns:
trueif 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. IfsignANSIistrue, 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
setNumberor thesetStringmethods.- Parameters:
signANSI- iftruenumeric fields will be stored using the ANSI mechanism. Otherwise, the TANDEM mechanism will be used.
-
getDefaultSignANSI
public static boolean getDefaultSignANSI()Returnstrueif, 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
setSignANSImethod.- Returns:
trueif, 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. IfsignANSIistrue, 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
setSignANSImethod.- Parameters:
signANSI- iftruenumeric fields will be stored, by default, using the ANSI format. Otherwise, the TANDEM format will be used.
-
getText
-
getTextTrim
Returns the text of this message with trailing space characters removed.- Returns:
- the text of this message with trailing space characters removed.
-
setText
Changes the text of this message.- Parameters:
text- the new text of this message (can be null).
-
isNull
public final boolean isNull(int start, int end) Returnstrueif a substring is NULL. A substring is said to be NULL if it's first character isNO-DATA(0x1A). The substring begins at the specifiedstartindex and extends to indexend-1.- Parameters:
start- the start index of the substring.end- the end index of the substring.- Returns:
trueif the substring is NULL.
-
substring
Returns a substring that begins at the specifiedstartindex and extends to indexend-1. It returnsnullif the first character of the substring isNO-DATA(0x1A). The trailing space characters of the substring are removed (right trimmed).- Parameters:
start- the start index of the substring.end- the end index of the substring.- Returns:
- the requiered substring or
null.
-
replace
Replaces a substring with the supplied stringvalue. The substring begins at the specifiedstartindex and extends to indexend-1. If needed, the capacity of the editor buffer is extended so the entirevaluecan be stored. Ifvalueisnull, the substring is filled with characterNO-DATA(0x1A). Ifvalueis shorter than the substring, the remaining space is filled with spaces.- 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 returnsnullif the message has no defined layout.- Returns:
- the layout of this message or
null.
-
setLayout
Changes the layout of this message. Iflayoutisnull, 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 suppliedlayoutName. This method throwsIllegalArgumentExceptionif 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:
layoutName- the name of the required layout.- Returns:
- the verified layout of this message (never
null). - Throws:
NullPointerException- iflayoutNameisnull.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 thegetDefaultmethod. 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. Ifsourceisnullor ifsourcehas 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 returnsnullif 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
fieldNameornull. - Throws:
NullPointerException- iffieldNameisnull.
-
exists
Returnstrueif the field indexed byfieldNameexists in theLayoutof this message. If returnsfalseif 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:
trueif the field is defined.- Throws:
NullPointerException- iffieldNameisnull.
-
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- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.
-
isNull
Returnstrueif the value of the field identified byfieldNameis NULL. The value of a field is said to be NULL if the first character of it's sequence isNO-DATA(0x1A).- Parameters:
fieldName- name of the required field.- Returns:
trueif the specified field is NULL.- Throws:
NullPointerException- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.
-
isNull
Returnstrueif the value of the field identified byfieldNameandindexis NULL. The value of a field is said to be NULL if the first character of it's sequence isNO-DATA(0x1A).- Parameters:
fieldName- name of the required field.index- index of the required field occurrence.- Returns:
trueif the specified field is NULL.- Throws:
NullPointerException- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.IndexOutOfBoundsException- ifindexis out-of-bounds.
-
setNull
Changes the value of the field identified byfieldNameto NULL. SeeisNullfor explanation of NULL value.- Parameters:
fieldName- name of the required field.- Throws:
NullPointerException- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.
-
setNull
Changes the value of the field identified byfieldNameandindexto NULL. SeeisNullfor explanation of NULL value.- Parameters:
fieldName- name of the required field.index- index of the required field occurrence.- Throws:
NullPointerException- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.IndexOutOfBoundsException- ifindexis out-of-bounds.
-
getSequence
Returns the unformatted character sequence of the field identified byfieldName. It returnsnullif this sequence starts with characterNO-DATA(0x1A). The trailing space characters of the returned string are removed (right trim).- Parameters:
fieldName- name of the required field.- Returns:
- the character sequence of the specified field or
null. - Throws:
NullPointerException- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.
-
getSequence
Returns the unformatted character sequence of the field identified byfieldNameandindex. It returnsnullif this sequence starts with characterNO-DATA(0x1A). The trailing space characters of the returned string are removed (right trim).- Parameters:
fieldName- name of the required field.index- index of the required field occurrence.- Returns:
- the character sequence of the specified field or
null. - Throws:
NullPointerException- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.IndexOutOfBoundsException- ifindexis out-of-bounds.
-
setSequence
Changes the unformatted character sequence of the field identified byfieldName. Ifvalueisnull, the sequence is filled with characterNO-DATA(0x1A).- Parameters:
fieldName- name of the required field.value- the new character sequence of the field (can be null).- Throws:
NullPointerException- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.
-
setSequence
Changes the unformatted character sequence of the field identified byfieldNameandindex. Ifvalueisnull, the sequence is filled with characterNO-DATA(0x1A).- Parameters:
fieldName- name of the required field.index- index of the required field occurrence.value- the new character sequence of the field (can be null).- Throws:
NullPointerException- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.IndexOutOfBoundsException- ifindexis out-of-bounds.
-
getString
Returns the string value of the field identified byfieldName. It returnsnullif the value of the field is NULL. SeeisNullfor explanation of NULL value.- Parameters:
fieldName- name of the required field.- Returns:
- the string value of the specified field or
null. - Throws:
NullPointerException- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.
-
getString
Returns the string value of the field identified byfieldNameandindex. It returnsnullif the value of the field is NULL. SeeisNullfor explanation of NULL value.If the field is a
FieldType.LISTandindexis-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- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.IndexOutOfBoundsException- ifindexis out-of-bounds.
-
setString
Changes the string value of the field identified byfieldName. Ifvalueisnull, the value of the field is set to NULL. SeeisNullfor explanation of NULL value.- Parameters:
fieldName- name of the required field.value- the new string value of the field (can be null)..- Throws:
NullPointerException- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.
-
setString
Changes the string value of the field identified byfieldNameandindex. Ifvalueisnullthen the value of the field is set to NULL. SeeisNullfor explanation of NULL value.If the field is a
FieldType.LISTandindexis-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- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.IndexOutOfBoundsException- ifindexis out-of-bounds.
-
getChar
Returns the character value of the field identified byfieldName. It returnsnullif the value of the field is NULL. SeeisNullfor explanation of NULL value.- Parameters:
fieldName- name of the required field.- Returns:
- the character value of the specified field or
null. - Throws:
NullPointerException- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.
-
getChar
Returns the character value of the field identified byfieldNameandindex. It returnsnullif the value of the field is NULL. SeeisNullfor explanation of NULL value.- 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- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.IndexOutOfBoundsException- ifindexis out-of-bounds.
-
setChar
Changes the character value of the field identified byfieldName. Ifvalueisnullthe value of the field is set to NULL. SeeisNullfor explanation of NULL value.- Parameters:
fieldName- name of the required field.value- the new character value of the field (can be null).- Throws:
NullPointerException- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.
-
setChar
Changes the character value of the field identified byfieldNameandindex. Ifvalueisnullthe value of the field is set to NULL. SeeisNullfor explanation of NULL value.- 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- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.IndexOutOfBoundsException- ifindexis out-of-bounds.
-
getNumber
Returns the decimal value of the field identified byfieldName. It returnsnullif the value of the field is NULL. SeeisNullfor explanation of NULL value.- Parameters:
fieldName- name of the required field.- Returns:
- the decimal value of the specified field or
null. - Throws:
NullPointerException- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.
-
getNumber
Returns the decimal value of the field identified byfieldNameandindex. It returnsnullif the value of the field is NULL. SeeisNullfor explanation of NULL value.- 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- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.IndexOutOfBoundsException- ifindexis out-of-bounds.
-
setNumber
Changes the decimal value of the field identified byfieldName. Ifvalueisnullthe value of the field is set to NULL. SeeisNullfor explanation of NULL value.- Parameters:
fieldName- name of the required field.value- the new decimal value of the field (can be null).- Throws:
NullPointerException- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.
-
setNumber
Changes the decimal value of the field identified byfieldNameandindex. Ifvalueisnullthen the field's data is set to NULL. SeeisNullfor explanation of NULL value.- 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- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.IndexOutOfBoundsException- ifindexis out-of-bounds.
-
getDouble
Returns the double value of the field identified byfieldName. It returnsnullif the value of the field is NULL. SeeisNullfor explanation of NULL value.- Parameters:
fieldName- name of the required field.- Returns:
- the double value of the specified field or
null. - Throws:
NullPointerException- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.
-
getDouble
Returns the double value of the field identified byfieldNameandindex. It returnsnullif the value of the field is NULL. SeeisNullfor explanation of NULL value.- 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- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.IndexOutOfBoundsException- ifindexis out-of-bounds.
-
setDouble
Changes the double value of the field identified byfieldName. Ifvalueisnull, the value of the field is set to NULL. SeeisNullfor explanation of NULL value.- Parameters:
fieldName- name of the required field.value- the new double value of the field (can be null).- Throws:
NullPointerException- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.
-
setDouble
Changes the double value of the field identified byfieldNameandindex. Ifvalueisnull, the value of the field is set to NULL. SeeisNullfor explanation of NULL value.- 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- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.IndexOutOfBoundsException- ifindexis out-of-bounds.
-
getInteger
Returns the integer value of the field identified byfieldName. It returnsnullif the value of the field is NULL. SeeisNullfor explanation of NULL value.- Parameters:
fieldName- name of the required field.- Returns:
- the integer value of the specified field or
null. - Throws:
NullPointerException- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.
-
getInteger
Returns the integer value of the field identified byfieldNameandindex. It returnsnullif the value of the field is NULL. SeeisNullfor explanation of NULL value.- 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- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.IndexOutOfBoundsException- ifindexis out-of-bounds.
-
setInteger
Changes the integer value of the field identified byfieldName. Ifvalueisnull, the value of the field is set to NULL. SeeisNullfor explanation of NULL value.- Parameters:
fieldName- name of the required field.value- the new integer value of the field (can be null).- Throws:
NullPointerException- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.
-
setInteger
Changes the integer value of the field identified byfieldNameandindex. Ifvalueisnull, the value of the field is set to NULL. SeeisNullfor explanation of NULL value.- 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- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.IndexOutOfBoundsException- ifindexis out-of-bounds.
-
getLong
Returns the long value of the field identified byfieldName. It returnsnullif the value of the field is NULL. SeeisNullfor explanation of NULL value.- Parameters:
fieldName- name of the required field.- Returns:
- the long value of the specified field or
null. - Throws:
NullPointerException- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.
-
getLong
Returns the long value of the field identified byfieldNameandindex. It returnsnullif the value of the field is NULL. SeeisNullfor explanation of NULL value.- 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- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.IndexOutOfBoundsException- ifindexis out-of-bounds.
-
setLong
Changes the long value of the field identified byfieldName. Ifvalueisnull, the value of the field is set to NULL. SeeisNullfor explanation of NULL value.- Parameters:
fieldName- name of the required field.value- the new long value of the field (can be null).- Throws:
NullPointerException- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.
-
setLong
Changes the long value of the field identified byfieldNameandindex. Ifvalueisnull, the value of the field is set to NULL. SeeisNullfor explanation of NULL value.- 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- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.IndexOutOfBoundsException- ifindexis out-of-bounds.
-
getDate
Returns the date value of the field identified byfieldName. It returnsnullif the value of the field is NULL. SeeisNullfor explanation of NULL value.- Parameters:
fieldName- name of the required field.- Returns:
- the date value of the specified field or
null. - Throws:
NullPointerException- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.
-
getDate
Returns the date value of the field identified byfieldNameandindex. It returnsnullif the value of the field is NULL. SeeisNullfor explanation of NULL value.- 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- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.IndexOutOfBoundsException- ifindexis out-of-bounds.
-
setDate
Changes the date value of the field identified byfieldName. Ifvalueisnullthe value of the field is set to NULL. SeeisNullfor explanation of NULL value.- Parameters:
fieldName- name of the required field.value- the new date value of the field (can be null).- Throws:
NullPointerException- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.
-
setDate
Changes the date value of the field identified byfieldNameandindex. Ifvalueisnullthen the field's data is set to NULL. SeeisNullfor explanation of NULL value.- 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- iffieldNameisnull.IllegalStateException- if no layout is defined.IllegalArgumentException- if the field does not exist.IndexOutOfBoundsException- ifindexis out-of-bounds.
-
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. IfomitXmlDeclarationistrue, the XML declaration header is not included. Theencodingargument specifies the character encoding included in the XML declaration header (for example"UTF-8"or"ISO-8859-1"). Ifindentistrue, the resulting XML will have whitespace included to indent the tree. The indentation amount is specified withindentAmount.Consider, for example, a layout named
CONTACTwith four fields calledSERVICE,GROUP,USERNAMEandUSERCODE. The string returned by this method for a message with layoutCONTACTwould 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- ifencodingisnull.IllegalArgumentException- ifindentAmountis 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
-
copyFrom
Copies all the properties of source into thisLayoutMessage. The values of all properties in thisLayoutMessageare replaced by copies of the values of corresponding source properties.- Parameters:
source- the sourceLayoutMessageto be copied.- Throws:
NullPointerException- ifsourceisnull.
-
clone
Returns a "deep" copy of thisLayoutMessage. -
toMessage
-