public final class ArrayValue extends ValueNode<ArrayValue> implements ValueNodeContainer, Iterable<ValueNode<?>>
getType()
method will return a FieldType
matching all elements or FieldType.UNDEFINED
if elements contain
different types. If ArrayValue has no elements, its defaultType
will be returned.SingleValue
,
Record
,
Node
,
Field
,
FieldType
,
Serialized FormNode.DuplicateNodeAction, Node.NodeType
Session.SessionImpl
Constructor and Description |
---|
ArrayValue() |
ArrayValue(FieldType defaultType)
Creates a new empty array.
|
ArrayValue(Object... collection) |
Modifier and Type | Method and Description |
---|---|
ArrayValue |
addAll(ArrayValue array) |
ArrayValue |
addNull(FieldType type) |
ArrayValue |
addNull(int index,
FieldType type) |
ArrayValue |
addValue(FieldType type,
Object element) |
ArrayValue |
addValue(int index,
FieldType type,
Object element) |
ArrayValue |
addValue(int index,
Object element) |
ArrayValue |
addValue(Object element) |
ArrayValue |
clone() |
int |
compareTo(ValueNode<ArrayValue> o) |
ArrayValue |
ensureCapacity(int minCapacity) |
boolean |
equals(Object o) |
void |
forEach(Consumer<? super ValueNode<?>> consumer)
Performs the given action for each element in this array.
|
protected static ArrayValue |
fromArray(Object array) |
FieldType |
getDefaultType() |
int |
getNodeDepth()
Returns this node's distance from its root node.
|
Node.NodeType |
getNodeType() |
long |
getSizeInBytes() |
FieldType |
getType()
Returns
defaultType if there are no elements, the FieldType matching all elements if they are the same
or FieldType.UNDEFINED if elements contain multiple types. |
ArrayValue |
getValue() |
Object |
getValue(int index)
Returns the value at the specified index (for zero or positive indexes) or from the end of the list (for negative indexes by adding index to the size of the list).
|
ArrayValue |
getValueAsArray(int index) |
BigDecimal |
getValueAsBigDecimal(int index) |
BigInteger |
getValueAsBigInteger(int index) |
boolean |
getValueAsBoolean(int index) |
byte |
getValueAsByte(int index) |
byte[] |
getValueAsBytes(int index) |
char |
getValueAsChar(int index) |
Date |
getValueAsDate(int index) |
Date |
getValueAsDatetime(int index) |
double |
getValueAsDouble(int index) |
float |
getValueAsFloat(int index) |
Instant |
getValueAsInstant(int index) |
int |
getValueAsInteger(int index) |
<T> List<T> |
getValueAsList(int index,
Class<T> elementType)
Returns the array element value at the specified index as a
List with each element coerced to the specified type. |
LocalDate |
getValueAsLocalDate(int index) |
LocalDateTime |
getValueAsLocalDateTime(int index) |
LocalTime |
getValueAsLocalTime(int index) |
long |
getValueAsLong(int index) |
Record |
getValueAsRecord(int index) |
short |
getValueAsShort(int index) |
SingleValue |
getValueAsSingleValue(int index) |
String |
getValueAsString() |
String |
getValueAsString(int index) |
Time |
getValueAsTime(int index) |
UUID |
getValueAsUuid(int index) |
ValueNode<?> |
getValueNode(int index)
Returns the value node at the specified index (for zero or positive indexes) or from the end of the list (for negative indexes by adding index to the size of the list).
|
List<Object> |
getValues()
Returns a list of values.
|
<T> List<T> |
getValues(Class<T> elementType)
Returns a list of values with each element coerced to the supplied type.
|
Stream<Object> |
getValueStream()
Returns a stream of values.
|
<T> Stream<T> |
getValueStream(Class<T> elementType)
Returns a stream of values with each element coerced to the supplied type.
|
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 container has had any value added, including null . |
int |
indexOfNode(Node child) |
int |
indexOfValue(Object value) |
boolean |
isArray() |
boolean |
isEmpty()
Returns
true if this array contains no elements -- equivalent to size() == 0. |
boolean |
isNotEmpty()
Returns
true if this array contains elements -- equivalent to size() > 0. |
boolean |
isRecord() |
boolean |
isSingleValue() |
Iterator<ValueNode<?>> |
iterator() |
Stream<ValueNode<?>> |
parallelStream()
Returns a parallel Stream of the elements in this array.
|
protected void |
removeChildNode(Node child) |
Object |
removeValue(int index) |
boolean |
removeValue(Object value) |
ArrayValue |
setDefaultType(FieldType defaultType) |
ArrayValue |
setNull(int index,
FieldType type) |
ArrayValue |
setValue(int index,
FieldType type,
Object element) |
ArrayValue |
setValue(int index,
Object element) |
int |
size() |
Stream<ValueNode<?>> |
stream()
Returns a sequential Stream of the elements in this array.
|
byte[] |
toBinary() |
String |
toJson() |
String |
toString() |
String |
toXml() |
asArray, from, getParentNode, isNotArray, isNotNull, isNotRecord, isNotSingleValue, isNull, isValueNode, nullValue, nullValue, setParentNode
assertNotAncestorOf, containsSessionProperty, containsSessionProperty, containsSessionProperty, copySessionPropertiesFrom, getParentField, getParentRecord, getSessionProperty, getSessionProperty, getSessionProperty, isAncestorOf, isChildNode, keySet, setSessionProperty, setSessionProperty, setSessionProperty
finalize, getClass, notify, notifyAll, wait, wait, wait
spliterator
public ArrayValue()
public ArrayValue(FieldType defaultType)
defaultType
- the value returned by getType()
if there are no elements.public ArrayValue(Object... collection)
public ArrayValue ensureCapacity(int minCapacity)
public ArrayValue addValue(FieldType type, Object element)
addValue
in interface ValueNodeContainer
public ArrayValue addValue(Object element)
addValue
in interface ValueNodeContainer
public ArrayValue addAll(ArrayValue array)
public ArrayValue addValue(int index, FieldType type, Object element)
public ArrayValue addValue(int index, Object element)
public ArrayValue setValue(int index, FieldType type, Object element)
public ArrayValue setValue(int index, Object element)
public ArrayValue addNull(FieldType type)
addNull
in interface ValueNodeContainer
public ArrayValue addNull(int index, FieldType type)
public ArrayValue setNull(int index, FieldType type)
public Object removeValue(int index)
public boolean removeValue(Object value)
public FieldType getDefaultType()
public ArrayValue setDefaultType(FieldType defaultType)
public FieldType getType()
defaultType
if there are no elements, the FieldType
matching all elements if they are the same
or FieldType.UNDEFINED
if elements contain multiple types.getType
in class ValueNode<ArrayValue>
public Node.NodeType getNodeType()
getNodeType
in class Node
public boolean hasChildNodes()
Node
true
if this node contains any sub nodes.hasChildNodes
in class Node
public boolean hasChildRecords()
Node
true
if this node contains any descendant, record nodes.hasChildRecords
in class Node
protected void removeChildNode(Node child)
removeChildNode
in class Node
public int indexOfNode(Node child)
public int indexOfValue(Object value)
public int getNodeDepth()
Node
getNodeDepth
in class Node
public boolean isArray()
isArray
in class ValueNode<ArrayValue>
public boolean isRecord()
isRecord
in class ValueNode<ArrayValue>
public boolean isSingleValue()
isSingleValue
in class ValueNode<ArrayValue>
public int size()
public boolean isEmpty()
true
if this array contains no elements -- equivalent to size()
== 0.public boolean isNotEmpty()
true
if this array contains elements -- equivalent to size()
> 0.public boolean hasValue()
ValueNodeContainer
true
if this container has had any value added, including null
.
Otherwise, it returns false
.hasValue
in interface ValueNodeContainer
public Object getValue(int index)
public <T> List<T> getValues(Class<T> elementType)
public <T> Stream<T> getValueStream(Class<T> elementType)
public ValueNode<?> getValueNode(int index)
public void forEach(Consumer<? super ValueNode<?>> consumer)
public Stream<ValueNode<?>> stream()
public Stream<ValueNode<?>> parallelStream()
public ArrayValue getValueAsArray(int index)
public Record getValueAsRecord(int index)
public SingleValue getValueAsSingleValue(int index)
public String getValueAsString(int index)
public Date getValueAsDatetime(int index)
public Date getValueAsDate(int index)
public Time getValueAsTime(int index)
public int getValueAsInteger(int index)
public long getValueAsLong(int index)
public short getValueAsShort(int index)
public byte getValueAsByte(int index)
public boolean getValueAsBoolean(int index)
public char getValueAsChar(int index)
public double getValueAsDouble(int index)
public float getValueAsFloat(int index)
public byte[] getValueAsBytes(int index)
public BigDecimal getValueAsBigDecimal(int index)
public BigInteger getValueAsBigInteger(int index)
public Instant getValueAsInstant(int index)
public LocalDateTime getValueAsLocalDateTime(int index)
public LocalDate getValueAsLocalDate(int index)
public LocalTime getValueAsLocalTime(int index)
public UUID getValueAsUuid(int index)
public ArrayValue getValue()
getValue
in class ValueNode<ArrayValue>
public String getValueAsString()
getValueAsString
in class ValueNode<ArrayValue>
public long getSizeInBytes()
getSizeInBytes
in class ValueNode<ArrayValue>
public int compareTo(ValueNode<ArrayValue> o)
compareTo
in interface Comparable<ValueNode<ArrayValue>>
public ArrayValue clone()
clone
in class ValueNode<ArrayValue>
public String toJson()
public String toXml()
public byte[] toBinary()
protected static ArrayValue fromArray(Object array)
Copyright (c) 2006-2024 North Concepts Inc. All Rights Reserved.