T
- V
- public static class Variant.CollectionVariant<T extends Collection<V>,V> extends Variant<T> implements Iterable<Variant<V>>
Variant.isPresent()
or Variant.get()
).isProperty
Variant.ClosureResultOrigin, Variant.ClosureVariant, Variant.CollectionVariant<T extends Collection<V>,V>, Variant.DereferenceOrigin, Variant.ListVariant<V>, Variant.MapVariant<K,V>, Variant.MethodResultOrigin, Variant.Origin, Variant.PropertyOrigin, Variant.RecordOrigin, Variant.RecordVariant, Variant.ReferenceOrigin, Variant.ScopedClosureVariant
Modifier and Type | Field and Description |
---|---|
protected Class<V> |
itemClass |
context, definitionType, NULL, origin
Constructor and Description |
---|
CollectionVariant(T data,
Type valueType,
Variant.Origin origin,
Class<V> itemClass,
LspsContextHolder context)
Creates the variant.
|
Modifier and Type | Method and Description |
---|---|
Variant.CollectionVariant<T,V> |
addAllTo(Collection<Variant<V>> targetCollection)
Adds all items from this collection to the target collection.
|
Variant.CollectionVariant<T,V> |
checkPresent()
Fails if the value is absent.
|
boolean |
isNullOrEmpty()
Checks whether the list is absent or empty (does not contain any items).
|
Iterator<Variant<V>> |
iterator()
Item iterator which provides items as variants with correct "origin".
|
Variant.CollectionVariant<T,V> |
orVariant(T defaultValue)
Returns this instance if it is present; a new variant with the defaultValue otherwise.
|
int |
size()
Returns the list size.
|
Variant.CollectionVariant<T,V> |
toNull()
Creates a new variant of same type and origin, but with null value.
|
Variant.CollectionVariant<T,V> |
toValue(T newValue)
Creates a new variant of same type and origin, but with given value.
|
bool, cast, closure, collection, collectionOf, date, decimal, definitionOf, definitionOf, dereference, enumerationConstant, enumValueOf, enumValueOfIgnoreCase, equals, fail, fail, get, getHandle, getInstanceType, getOrigin, hasHandle, hashCode, instanceOf, integer, isAbsent, isClosure, isPath, isPresent, isProperty, isPropertyPath, isRecord, list, listHolder, listOf, map, mapHolder, mapOf, ofOrigin, ofUnknownOrigin, ofUnknownOrigin, or, param, path, property, propertyPath, record, reference, requireDefined, set, setHolder, setOf, setReferencedValue, setReferencedValueCollection, startTransaction, string, toString, toUpperCase, valueOrNull, wrap
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public CollectionVariant(T data, Type valueType, Variant.Origin origin, Class<V> itemClass, LspsContextHolder context)
data
- the value, may be null.valueType
- The type of the value, either the record property type, or the closure result type. null: see Variant.requireDefined()
.origin
- The value origin, such as "ui::Geolocation.latitude".itemClass
- context
- used for value serialization/deserialization, may be null in special cases.public int size()
public Iterator<Variant<V>> iterator()
iterator
in interface Iterable<Variant<V>>
IllegalStateException
- if underlying list is null.public Variant.CollectionVariant<T,V> toNull()
toNull
in class Variant<T extends Collection<V>>
public Variant.CollectionVariant<T,V> toValue(T newValue)
toValue
in class Variant<T extends Collection<V>>
newValue
- the new value, may be null.public Variant.CollectionVariant<T,V> checkPresent()
Variant
checkPresent
in class Variant<T extends Collection<V>>
public boolean isNullOrEmpty()
public Variant.CollectionVariant<T,V> orVariant(T defaultValue)
Variant
Variant.get()
instead.
For a default value of null, use Variant.valueOrNull()
.orVariant
in class Variant<T extends Collection<V>>
defaultValue
- the default value, may be null.public Variant.CollectionVariant<T,V> addAllTo(Collection<Variant<V>> targetCollection)
Variant.isAbsent()
, nothing is done.targetCollection
- the target collection, not null.Copyright © 2007-2018 Whitestein Technologies. All Rights Reserved.