java.lang.Object
cl.netswitch.lib.layout.LayoutField
- All Implemented Interfaces:
Serializable
Data item whose value can be edited with a
LayoutMessage
. A
LayoutField
has a type
, a name, a length, a numeric scale
and a default value. The values of these properties have restrictions
depending on the type of the field. See FieldType
for details about
these restrictions.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionfinal Character
getChar
(LayoutMessage message, int index) Returns the first character of the string value of theindex
occurence of this field inmessage
.getDate
(LayoutMessage message, int index) Returns the date value of theindex
occurence of this field inmessage
.Returns the default value of this field.final String
Returns the defined default value of this field.final Double
getDouble
(LayoutMessage message, int index) Returns the double value of theindex
occurence of this field inmessage
.final Integer
getInteger
(LayoutMessage message, int index) Returns the integer value of theindex
occurence of this field inmessage
.final Layout
Returns the layout of this field.final int
Returns the length of each occurrence of this field.final Long
getLong
(LayoutMessage message, int index) Returns the long value of theindex
occurence of this field inmessage
.final String
getName()
Returns the name of this field.getNumber
(LayoutMessage message, int index) Returns the decimal value of theindex
occurence of this field inmessage
.final int
Returns the number of occurrences of this field.final int
getOffset
(int index) Returns the offset position of theindex
occurence of this field in a message or it's parent list.final LayoutField
Returns the list field that contains this field.final int
getScale()
Returns the numeric scale of this field.final String
getSequence
(LayoutMessage message, int index) Returns the unformatted character sequence of theindex
occurence of this field inmessage
.getString
(LayoutMessage message, int index) Returns the string value of theindex
occurence of this field inmessage
.abstract FieldType
getType()
Returns the type of this field.final boolean
isNull
(LayoutMessage message, int index) Returnstrue
is the character sequence of theindex
occurence of this field inmessage
is NULL.final void
setChar
(LayoutMessage message, int index, Character value) Changes the character value of theindex
occurence of this field inmessage
.void
setDate
(LayoutMessage message, int index, Date date) Changes the date value of theindex
occurence of this field inmessage
.void
setDefault
(LayoutMessage message, int index) Changes the value of theindex
occurence of this field inmessage
to its default value.final void
setDouble
(LayoutMessage message, int index, Double value) Changes the double value of theindex
occurence of this field inmessage
.final void
setInteger
(LayoutMessage message, int index, Integer value) Changes the integer value of theindex
occurence of this field inmessage
.final void
setLong
(LayoutMessage message, int index, Long value) Changes the long value of theindex
occurence of this field inmessage
.void
setNull
(LayoutMessage message, int index) Changes the character sequence of theindex
occurence of this field inmessage
with the NULL value.void
setNumber
(LayoutMessage message, int index, BigDecimal value) Changes the decimal value of theindex
occurence of this field inmessage
.final void
setSequence
(LayoutMessage message, int index, String value) Changes the unformatted character sequence of theindex
occurence of this field inmessage
.void
setString
(LayoutMessage message, int index, String value) Changes the string value of theindex
occurence of this field inmessage
.
-
Method Details
-
getType
Returns the type of this field.- Returns:
- the type of this field.
-
getLayout
Returns the layout of this field.- Returns:
- the layout of this field.
-
getName
Returns the name of this field.- Returns:
- the name of this field.
-
getLength
public final int getLength()Returns the length of each occurrence of this field.- Returns:
- the length of each occurrence of this field.
-
getScale
public final int getScale()Returns the numeric scale of this field.- Returns:
- the numeric scale of this field.
-
getOccurs
public final int getOccurs()Returns the number of occurrences of this field.- Returns:
- the number of occurrences of this field.
-
getDefinedDefault
Returns the defined default value of this field. If the field does not have a defined default value, it returnsnull
.- Returns:
- the default value of this field or
null
if the field does not have a defined default value.
-
getDefault
Returns the default value of this field. If the field does not have a defined default value, it returns the default value associatted with itstype
. This method never returnsnull
.- Returns:
- the default value of this field or the default value associatted
with its
type
.
-
setDefault
Changes the value of theindex
occurence of this field inmessage
to its default value. If the field's default value is invalid, then the type's default value is used.- Parameters:
message
- the layout message editor.index
- the occurence index of the field.- Throws:
NullPointerException
- ifmessage
isnull
.IndexOutOfBoundsException
- ifindex
is out-of-bounds.
-
getParent
Returns the list field that contains this field. If this field does not belong to a list, it returnsnull
. Fields of typeFieldType.LIST
always returnnull
because list fields cannot be defined (contained) within other lists.- Returns:
- the list field that contains this field or
null
.
-
getOffset
public final int getOffset(int index) Returns the offset position of theindex
occurence of this field in a message or it's parent list.- Parameters:
index
- the occurence index of the field.- Returns:
- the offset position of this field in a message or parent list.
- Throws:
IndexOutOfBoundsException
- ifindex
is out-of-bounds.
-
getSequence
Returns the unformatted character sequence of theindex
occurence of this field inmessage
. The character sequence starts at the offset position returned by thegetOffset(int)
method, and it's length is given by thegetLength()
method. Trailing space characters of the returned sequence are removed (right trimmed).- Parameters:
message
- the layout message editor.index
- the occurence index of the field.- Returns:
- the unformatted character sequence or
null
. - Throws:
NullPointerException
- ifmessage
isnull
.IndexOutOfBoundsException
- ifindex
is out-of-bounds.
-
setSequence
Changes the unformatted character sequence of theindex
occurence of this field inmessage
. The character sequence starts at the offset position returned by thegetOffset(int)
method, and it's length is given by thegetLength()
method. Ifvalue
is too short, it is extended with space characters. Ifvalue
is too long, it is truncated. Ifvalue
isnull
the sequence is filled with characterNO-DATA
(0x1A).- Parameters:
message
- the layout message editor.index
- the occurence index of the field.value
- the new character sequence of this field (can be null).- Throws:
NullPointerException
- ifmessage
isnull
.IndexOutOfBoundsException
- ifindex
is out-of-bounds.IllegalArgumentException
- if strict andvalue
is too long.
-
isNull
Returnstrue
is the character sequence of theindex
occurence of this field inmessage
is NULL. The value of a field is said to be NULL if the first character of it's character sequence isNO-DATA
(0x1A).- Parameters:
message
- the layout message editor.index
- the occurence index of the field.- Returns:
true
if the value of this field is NULL.- Throws:
NullPointerException
- ifmessage
isnull
.IndexOutOfBoundsException
- ifindex
is out-of-bounds.
-
setNull
Changes the character sequence of theindex
occurence of this field inmessage
with the NULL value. The value of a field is said to be NULL if the first character of it's character sequence isNO-DATA
(0x1A).- Parameters:
message
- the layout message editor.index
- the occurence index of the field.- Throws:
NullPointerException
- ifmessage
isnull
.IndexOutOfBoundsException
- ifindex
is out-of-bounds.
-
getString
Returns the string value of theindex
occurence of this field inmessage
. It returnsnull
if the value of the field is NULL. SeeisNull
for explanation of NULL value.- Parameters:
message
- the layout message editor.index
- the occurence index of the field.- Returns:
- the string value of this field or
null
. - Throws:
NullPointerException
- ifmessage
isnull
.IndexOutOfBoundsException
- ifindex
is out-of-bounds.
-
setString
Changes the string value of theindex
occurence of this field inmessage
. The suppliedvalue
is formatted according to the type of this field, and the resulting text is stored inmessage
. Ifvalue
isnull
, the value of the field is set to NULL. SeeisNull
for explanation of NULL value.- Parameters:
message
- the layout message editor.index
- the occurence index of the field.value
- the string representation of the field value.- Throws:
NullPointerException
- ifmessage
isnull
.IndexOutOfBoundsException
- ifindex
is out-of-bounds.
-
getChar
Returns the first character of the string value of theindex
occurence of this field inmessage
. It returnsnull
if the value of the field is NULL. SeeisNull
for explanation of NULL value.- Parameters:
message
- the layout message editor.index
- the occurence index of the field.- Returns:
- the character value of the field or
null
. - Throws:
NullPointerException
- ifmessage
isnull
.IndexOutOfBoundsException
- ifindex
is out-of-bounds.
-
setChar
Changes the character value of theindex
occurence of this field inmessage
. Ifvalue
isnull
, the value of the field is set to NULL. SeeisNull
for explanation of NULL value.- Parameters:
message
- the layout message editor.index
- the occurence index of the field.value
- the new character value of the field (can be null).- Throws:
NullPointerException
- ifmessage
isnull
.IndexOutOfBoundsException
- ifindex
is out-of-bounds.
-
getNumber
Returns the decimal value of theindex
occurence of this field inmessage
. This method can only be used if the type of this field isNUMERIC
orSIGNED
. It returnsnull
if the value of the field is NULL. SeeisNull
for explanation of NULL value.- Parameters:
message
- the layout message editor.index
- the occurence index of the field.- Returns:
- the decimal value of this field or
null
. - Throws:
NullPointerException
- ifmessage
isnull
.IndexOutOfBoundsException
- ifindex
is out-of-bounds.UnsupportedOperationException
- if the type of this field is notNUMERIC
orSIGNED
.
-
setNumber
Changes the decimal value of theindex
occurence of this field inmessage
. This method can only be used if the type of this field isNUMERIC
orSIGNED
. Ifdecimal
isnull
, the value of the field is set to NULL. SeeisNull
for explanation of NULL value.- Parameters:
message
- the layout message editor.index
- the occurence index of the field.value
- decimal value of the field (can be null).- Throws:
NullPointerException
- ifmessage
isnull
.IndexOutOfBoundsException
- ifindex
is out-of-bounds.UnsupportedOperationException
- if the type of this field is notNUMERIC
orSIGNED
.
-
getDouble
Returns the double value of theindex
occurence of this field inmessage
. It returnsnull
if the value of the field is NULL. SeeisNull
for explanation of NULL value.- Parameters:
message
- the layout message editor.index
- the occurence index of the field.- Returns:
- the double value of the field or
null
. - Throws:
NullPointerException
- ifmessage
isnull
.IndexOutOfBoundsException
- ifindex
is out-of-bounds.UnsupportedOperationException
- if the type of this field is notNUMERIC
orSIGNED
.
-
setDouble
Changes the double value of theindex
occurence of this field inmessage
. Ifvalue
isnull
, the value of the field is set to NULL. SeeisNull
for explanation of NULL value.- Parameters:
message
- the layout message editor.index
- the occurence index of the field.value
- the new double value of the field (can be null).- Throws:
NullPointerException
- ifmessage
isnull
.IndexOutOfBoundsException
- ifindex
is out-of-bounds.UnsupportedOperationException
- if the type of this field is notNUMERIC
orSIGNED
.
-
getInteger
Returns the integer value of theindex
occurence of this field inmessage
. It returnsnull
if the value of the field is NULL. SeeisNull
for explanation of NULL value.- Parameters:
message
- the layout message editor.index
- the occurence index of the field.- Returns:
- the integer value of the the field or
null
. - Throws:
NullPointerException
- ifmessage
isnull
.IndexOutOfBoundsException
- ifindex
is out-of-bounds.UnsupportedOperationException
- if the type of this field is notNUMERIC
orSIGNED
.
-
setInteger
Changes the integer value of theindex
occurence of this field inmessage
. Ifvalue
isnull
, the value of the field is set to NULL. SeeisNull
for explanation of NULL value.- Parameters:
message
- the layout message editor.index
- the occurence index of the field.value
- the new integer value of the field (can be null).- Throws:
NullPointerException
- ifmessage
isnull
.IndexOutOfBoundsException
- ifindex
is out-of-bounds.UnsupportedOperationException
- if the type of this field is notNUMERIC
orSIGNED
.
-
getLong
Returns the long value of theindex
occurence of this field inmessage
. It returnsnull
if the value of the field is NULL. SeeisNull
for explanation of NULL value.- Parameters:
message
- the layout message editor.index
- the occurence index of the field.- Returns:
- the long value of the the field or
null
. - Throws:
NullPointerException
- ifmessage
isnull
.IndexOutOfBoundsException
- ifindex
is out-of-bounds.UnsupportedOperationException
- if the type of this field is notNUMERIC
orSIGNED
.
-
setLong
Changes the long value of theindex
occurence of this field inmessage
. Ifvalue
isnull
, the value of the field is set to NULL. SeeisNull
for explanation of NULL value.- Parameters:
message
- the layout message editor.index
- the occurence index of the field.value
- the new long value of the field (can be null).- Throws:
NullPointerException
- ifmessage
isnull
.IndexOutOfBoundsException
- ifindex
is out-of-bounds.UnsupportedOperationException
- if the type of this field is notNUMERIC
orSIGNED
.
-
getDate
Returns the date value of theindex
occurence of this field inmessage
. This method can only be used if the type of this field isDATE
. It returnsnull
if the value of the field is NULL. SeeisNull
for explanation of NULL value.- Parameters:
message
- the layout message editor.index
- the occurence index of the field.- Returns:
- the date value of this field or
null
. - Throws:
NullPointerException
- ifmessage
isnull
.IndexOutOfBoundsException
- ifindex
is out-of-bounds.UnsupportedOperationException
- if the type of this field is notDATE
.
-
setDate
Changes the date value of theindex
occurence of this field inmessage
. This method can only be used if the type of this field isDATE
. Ifdate
isnull
, the value of the field is set to NULL. SeeisNull
for explanation of NULL value.- Parameters:
message
- the layout message editor.index
- the occurence index of the field.date
- the new date value of the field (can be null).- Throws:
NullPointerException
- ifmessage
isnull
.IndexOutOfBoundsException
- ifindex
is out-of-bounds.UnsupportedOperationException
- if the type of this field is notDATE
.
-