V
- entry typepublic static class Variant.ListVariant<V> extends Variant.CollectionVariant<List<V>,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
itemClass
context, definitionType, NULL, origin
Constructor and Description |
---|
ListVariant(List<V> data,
Type valueType,
Variant.Origin origin,
Class<V> itemType,
LspsContextHolder context)
Creates the variant.
|
Modifier and Type | Method and Description |
---|---|
Variant.ListVariant<V> |
checkPresent()
Fails if the value is absent.
|
Variant<V> |
get(int index)
Returns i-th item from the list as a Variant.
|
Iterator<Variant<V>> |
iterator()
Item iterator which provides items as variants with correct "origin".
|
Variant.ListVariant<V> |
orEmptyList() |
Variant.ListVariant<V> |
orVariant(List<V> defaultValue)
Returns this instance if it is present; a new variant with the defaultValue otherwise.
|
Variant.ListVariant<V> |
toNull()
Creates a new variant of same type and origin, but with null value.
|
Variant.ListVariant<V> |
toValue(List<V> newValue)
Creates a new variant of same type and origin, but with given value.
|
List<Variant<V>> |
toVariantList()
Converts this list to a list of variants.
|
addAllTo, isNullOrEmpty, size
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 ListVariant(List<V> data, Type valueType, Variant.Origin origin, Class<V> itemType, 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".itemType
- context
- public Variant<V> get(int index)
index
- the index, 0-based.IllegalStateException
- if the index is invalid.public Iterator<Variant<V>> iterator()
iterator
in interface Iterable<Variant<V>>
iterator
in class Variant.CollectionVariant<List<V>,V>
IllegalStateException
- if underlying list is null.public Variant.ListVariant<V> toNull()
toNull
in class Variant.CollectionVariant<List<V>,V>
public Variant.ListVariant<V> toValue(List<V> newValue)
toValue
in class Variant.CollectionVariant<List<V>,V>
newValue
- the new value, may be null.public Variant.ListVariant<V> checkPresent()
Variant
checkPresent
in class Variant.CollectionVariant<List<V>,V>
public Variant.ListVariant<V> orVariant(List<V> defaultValue)
Variant
Variant.get()
instead.
For a default value of null, use Variant.valueOrNull()
.orVariant
in class Variant.CollectionVariant<List<V>,V>
defaultValue
- the default value, may be null.public Variant.ListVariant<V> orEmptyList()
public List<Variant<V>> toVariantList()
IllegalStateException
- if the list is null.Copyright © 2007-2018 Whitestein Technologies. All Rights Reserved.