public static class Variant.RecordVariant extends Variant<RecordHolder>
RecordHolder
properties.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
context, definitionType, NULL, origin
Constructor and Description |
---|
RecordVariant(RecordHolder data,
Type valueType,
Variant.Origin origin,
LspsContextHolder context)
Creates the variant.
|
Modifier and Type | Method and Description |
---|---|
Variant<Object> |
call(Namespace namespace,
String methodName,
Object... args)
Calls given class method and returns the result.
|
Variant<Object> |
call(Namespace namespace,
String methodName,
Type[] parameterTypes,
Object... args)
Calls given class method and returns the result.
|
Variant.RecordVariant |
checkPresent()
Fails if the value is absent.
|
Variant.RecordVariant |
checkSubtypeOf(String type)
Checks that the record is of given type or is its subtype.
|
Variant.RecordVariant |
checkSubtypeOf(String type,
String message)
Checks that the record is of given type or is its subtype.
|
Variant.RecordVariant |
checkType(String type)
Checks that the record is of given type.
|
Variant<Object> |
getPropertyValue(String propName)
Returns given property value.
|
Variant<Object> |
getPropertyValue(String propName,
boolean nullIfMissing)
Returns given property value.
|
String |
getTypeFullName()
Returns
NamedClassType.getFullName() . |
boolean |
hasProperty(String propName)
Checks whether the record has given property defined.
|
Variant.RecordVariant |
inLevel(ContextWrapper context) |
boolean |
isGCd()
Checks whether the underlying
RecordHolder has been garbage-collected. |
boolean |
isSubtypeOf(String type)
Checks that the record is of given type or is its subtype.
|
Variant.RecordVariant |
orVariant(RecordHolder defaultValue)
Returns this instance if it is present; a new variant with the defaultValue otherwise.
|
void |
setPropertyValue(String propertyName,
Object value)
Sets given property value.
|
Variant.RecordVariant |
toValue(RecordHolder 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, toNull, toString, toUpperCase, valueOrNull, wrap
public RecordVariant(RecordHolder data, Type valueType, Variant.Origin origin, 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". Must not be null.context
- public Variant.RecordVariant checkType(String type)
type
- the type, e.g. "ui::CalendarItem". Not null.IllegalStateException
- if the record type does not match.public boolean isSubtypeOf(String type)
type
- the full name of the type, e.g. "ui::CalendarItem". Not null.Variant.record()
is of given type or is a subtype of given type.IllegalStateException
- if the record type does not match or if the record is absent (null).public Variant.RecordVariant checkSubtypeOf(String type)
type
- the full name of the type, e.g. "ui::CalendarItem". Not null. This record must either be of given type, extend given type, or in case of interfaces,
must be an implementor of given interface.IllegalStateException
- if the record type does not match or the record is absent (null).public Variant.RecordVariant checkSubtypeOf(String type, String message)
type
- the full name of the type, e.g. "ui::CalendarItem". Not null.message
- optional additional message, may be null.IllegalStateException
- if the record type does not match or the record is absent.public String getTypeFullName()
NamedClassType.getFullName()
.public Variant<Object> getPropertyValue(String propName)
propName
- the property name, not null.public boolean isGCd()
RecordHolder
has been garbage-collected. If yes, all fields are set to null and the holder is no longer valid.public Variant<Object> getPropertyValue(String propName, boolean nullIfMissing)
propName
- the property name, not null.nullIfMissing
- if this is true and there is no such property, do not fail - return null instead.public Variant.RecordVariant checkPresent()
checkPresent
in class Variant<RecordHolder>
IllegalStateException
- if the value is absent (value is null)public boolean hasProperty(String propName)
propName
- the property name, not null.public Variant.RecordVariant toValue(RecordHolder newValue)
toValue
in class Variant<RecordHolder>
newValue
- the new value, may be null.public Variant.RecordVariant orVariant(RecordHolder defaultValue)
Variant
Variant.get()
instead.
For a default value of null, use Variant.valueOrNull()
.orVariant
in class Variant<RecordHolder>
defaultValue
- the default value, may be null.public Variant.RecordVariant inLevel(ContextWrapper context)
context
- public Variant<Object> call(Namespace namespace, String methodName, Object... args)
namespace
- methodName
- the name of the method, not null.args
- parameters of the method, may be null if the method does not take any parameters.public Variant<Object> call(Namespace namespace, String methodName, Type[] parameterTypes, Object... args)
namespace
- methodName
- the name of the method, not null.parameterTypes
- the types of the method parameters as defined in the method signature. This parameter allows
to specify what method should be called if the method is overloadedargs
- parameters of the method, may be null if the method does not take any parameters.Copyright © 2007-2018 Whitestein Technologies. All Rights Reserved.