public final class Field extends Node implements ValueNodeContainer, Comparable<Field>, Serializable
FieldType)SingleValue,
Record,
ArrayValue,
FieldType,
Serialized FormNode.DuplicateNodeAction, Node.NodeTypeSession.SessionImpl| Modifier and Type | Field and Description |
|---|---|
static int |
JAVA_ARRAY_SIZE |
static int |
JAVA_OBJECT_SIZE |
static int |
MAX_DISPLAY_STRING |
| Modifier | Constructor and Description |
|---|---|
protected |
Field(Record record) |
| Modifier and Type | Method and Description |
|---|---|
Field |
addNull(FieldType type) |
Field |
addValue(FieldType type,
Object value) |
Field |
addValue(Object value) |
int |
compareTo(Field field) |
int |
compareTo(Field field,
Collator collator) |
Field |
copyFrom(Field field) |
Field |
copyFrom(Field field,
boolean copyName) |
boolean |
equals(Object o) |
boolean |
equals(Object o,
Collator collator) |
Field |
forceValueAsArray()
Converts this field's value to an array if it's not already one, otherwise no change is made.
|
int |
getIndex()
Returns the position of this field within its record.
|
String |
getName() |
String |
getName(boolean nullToDefaultName) |
Node.NodeType |
getNodeType() |
Node |
getParentNode() |
Record |
getParentRecord()
Returns the closest parent record that this node is the child of, otherwise null if one does not exist.
|
Record |
getRecord()
Returns the record this field belongs to.
|
long |
getSizeInBytes() |
long |
getSizeOfNameInBytes() |
FieldType |
getType() |
Object |
getValue() |
ArrayValue |
getValueAsArray()
Retrieve the field's value as an
ArrayValue. |
ArrayValue |
getValueAsArray(boolean force)
Retrieve the field's value as an
ArrayValue. |
BigDecimal |
getValueAsBigDecimal() |
BigInteger |
getValueAsBigInteger() |
boolean |
getValueAsBoolean() |
byte |
getValueAsByte() |
byte[] |
getValueAsBytes() |
char |
getValueAsChar() |
Date |
getValueAsDate() |
Date |
getValueAsDatetime() |
double |
getValueAsDouble() |
float |
getValueAsFloat() |
Instant |
getValueAsInstant() |
int |
getValueAsInteger() |
<T> List<T> |
getValueAsList(boolean force,
Class<T> elementType)
Retrieve the field's value as a
List. |
LocalDate |
getValueAsLocalDate() |
LocalDateTime |
getValueAsLocalDateTime() |
LocalTime |
getValueAsLocalTime() |
long |
getValueAsLong() |
Record |
getValueAsRecord() |
short |
getValueAsShort() |
SingleValue |
getValueAsSingleValue() |
String |
getValueAsString() |
Time |
getValueAsTime() |
UUID |
getValueAsUuid() |
ValueNode<?> |
getValueNode() |
boolean |
hasChildNodes()
Returns
true if this node contains any sub nodes. |
boolean |
hasChildRecords()
Returns
true if this node contains any descendant, record nodes. |
int |
hashCode() |
boolean |
hasValue()
Returns
true if this field has been set to a value, including null. |
boolean |
isArray() |
boolean |
isNotArray() |
boolean |
isNotNull()
Returns
true if this node does not contain a null value. |
boolean |
isNotRecord() |
boolean |
isNotSingleValue() |
boolean |
isNull()
Returns
true if this node contains a null value. |
boolean |
isRecord() |
boolean |
isSingleValue() |
boolean |
isValueNotSet() |
boolean |
isValueSet() |
boolean |
remove()
Removes this field from its parent record.
|
protected void |
removeChildNode(Node child) |
Field |
setName(String name) |
Field |
setNull(FieldType type) |
Field |
setValue(BigDecimal value) |
Field |
setValue(BigInteger value) |
Field |
setValue(boolean value) |
Field |
setValue(byte value) |
Field |
setValue(byte[] value) |
Field |
setValue(char value) |
Field |
setValue(Date value) |
Field |
setValue(Date value) |
Field |
setValue(double value) |
Field |
setValue(float value) |
Field |
setValue(Instant value) |
Field |
setValue(int value) |
Field |
setValue(LocalDate value) |
Field |
setValue(LocalDateTime value) |
Field |
setValue(LocalTime value) |
Field |
setValue(long value) |
Field |
setValue(Object value) |
Field |
setValue(Record value) |
Field |
setValue(short value) |
Field |
setValue(String value) |
Field |
setValue(Time value) |
Field |
setValue(UUID value) |
String |
toString() |
assertNotAncestorOf, containsSessionProperty, containsSessionProperty, containsSessionProperty, copySessionPropertiesFrom, getNodeDepth, getParentField, getSessionProperty, getSessionProperty, getSessionProperty, isAncestorOf, isChildNode, isValueNode, keySet, setSessionProperty, setSessionProperty, setSessionPropertypublic static final int MAX_DISPLAY_STRING
public static final int JAVA_OBJECT_SIZE
public static final int JAVA_ARRAY_SIZE
protected Field(Record record)
public Node.NodeType getNodeType()
getNodeType in class Nodepublic boolean hasChildNodes()
Nodetrue if this node contains any sub nodes.hasChildNodes in class Nodepublic boolean hasChildRecords()
Nodetrue if this node contains any descendant, record nodes.hasChildRecords in class Nodeprotected void removeChildNode(Node child)
removeChildNode in class Nodepublic boolean remove()
true if the record contained this field (i.e. the field hadn't already been removed).public int getIndex()
public String getName()
public String getName(boolean nullToDefaultName)
public FieldType getType()
public boolean isArray()
public boolean isNotArray()
public boolean isRecord()
public boolean isSingleValue()
public boolean isNotSingleValue()
public boolean isNotRecord()
public Field forceValueAsArray()
public boolean isValueSet()
public boolean isValueNotSet()
public boolean hasValue()
true if this field has been set to a value, including null.
Otherwise, it returns false.
This method is an alias for isValueSet().hasValue in interface ValueNodeContainerpublic boolean isNull()
Nodetrue if this node contains a null value. In concrete terms, only Field and SingleValue can contain nulls while not
being null themselves. Both Record and ArrayValue will return false even if they have no values or null only values.public boolean isNotNull()
Nodetrue if this node does not contain a null value. In concrete terms, only Field and SingleValue can contain nulls
while not being null themselves. Both Record and ArrayValue will return true even if they have no values or null only
values.public Field addValue(FieldType type, Object value)
addValue in interface ValueNodeContainerpublic Field addValue(Object value)
addValue in interface ValueNodeContainerpublic Field addNull(FieldType type)
addNull in interface ValueNodeContainerpublic int compareTo(Field field)
compareTo in interface Comparable<Field>public long getSizeOfNameInBytes()
public long getSizeInBytes()
public Record getRecord()
public Record getParentRecord()
NodegetParentRecord in class NodeNode.getParentField(),
Node.isChildNode(),
Node.hasChildRecords(),
Node.getNodeDepth(),
getValueAsRecord(),
Field#getValueAsRecords()public Node getParentNode()
getParentNode in class Nodepublic Object getValue()
public ValueNode<?> getValueNode()
public ArrayValue getValueAsArray()
ArrayValue.public ArrayValue getValueAsArray(boolean force)
ArrayValue. An exception will be thrown when typecasting if the value is not an ArrayValue.public <T> List<T> getValueAsList(boolean force, Class<T> elementType)
List.T - The list's parameterized element typeforce - indicates if a field containing a single value should be forced to become an ArrayValue of one element, otherwise, an exception will be thrown when the typecast to ArrayValue fails.elementType - the target Class of the list's elements. This is used internally to coerce the actual value into this desired type.public Record getValueAsRecord()
public SingleValue getValueAsSingleValue()
public String getValueAsString()
public Date getValueAsDatetime()
public Date getValueAsDate()
public Time getValueAsTime()
public int getValueAsInteger()
public long getValueAsLong()
public short getValueAsShort()
public byte getValueAsByte()
public boolean getValueAsBoolean()
public char getValueAsChar()
public double getValueAsDouble()
public float getValueAsFloat()
public byte[] getValueAsBytes()
public BigDecimal getValueAsBigDecimal()
public BigInteger getValueAsBigInteger()
public Instant getValueAsInstant()
public LocalDateTime getValueAsLocalDateTime()
public LocalDate getValueAsLocalDate()
public LocalTime getValueAsLocalTime()
public UUID getValueAsUuid()
public Field setValue(int value)
public Field setValue(long value)
public Field setValue(short value)
public Field setValue(byte value)
public Field setValue(boolean value)
public Field setValue(char value)
public Field setValue(double value)
public Field setValue(float value)
public Field setValue(byte[] value)
public Field setValue(BigDecimal value)
public Field setValue(BigInteger value)
public Field setValue(LocalDateTime value)
Copyright (c) 2006-2025 North Concepts Inc. All Rights Reserved.