public final class AccessAny
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static DataFactory |
FACTORY
factory for Any.
|
Modifier and Type | Method and Description |
---|---|
static Any |
get(AnyMap any,
java.lang.String fieldName,
Any.ValueType fieldType)
get a field value from a Map and check that it has an expected type.
|
static boolean |
getBoolean(AnyMap any,
java.lang.String fieldName,
boolean defaultValue)
get a boolean from a Map.
|
static AnySeq |
getSeq(AnyMap any,
java.lang.String fieldName)
get a sequence from a Map.
|
static java.lang.String |
getString(AnyMap any,
java.lang.String fieldName)
get a string from a Map.
|
static java.lang.String |
getStringRequired(AnyMap any,
java.lang.String fieldName)
like
#getString(Any, String) , but throw an exception if the field does not exists. |
static java.util.List<java.lang.String> |
getStringSeq(AnyMap any,
java.lang.String fieldName)
get list of strings from a field of the any.
|
static java.lang.String |
getValidName(AnyMap any,
java.lang.String fieldName)
like
#getStringRequired(Any, String) , but throw an exception if value is not a valid name accoring to
NameValidator . |
static ValueExpression |
getValueExpression(AnyMap any,
java.lang.String fieldName)
get a value expression from a Map.
|
static ValueExpression |
getValueExpressionRequired(AnyMap any,
java.lang.String fieldName)
like
#getValueExpression(Any, String) , but throw an exception if the field does not exists. |
public static final DataFactory FACTORY
public static Any get(AnyMap any, java.lang.String fieldName, Any.ValueType fieldType) throws InvalidDefinitionException
any
- a map any.fieldName
- key.fieldType
- expected field typeInvalidDefinitionException
- any is not a map, value does not have expected type or error accessing any.public static ValueExpression getValueExpression(AnyMap any, java.lang.String fieldName) throws InvalidDefinitionException
any
- a map any.fieldName
- key.InvalidDefinitionException
- any is not a map, value is not a string or error accessing any.public static java.lang.String getString(AnyMap any, java.lang.String fieldName) throws InvalidDefinitionException
any
- a map any.fieldName
- key.InvalidDefinitionException
- any is not a map, value is not a string or error accessing any.public static AnySeq getSeq(AnyMap any, java.lang.String fieldName) throws InvalidDefinitionException
any
- a map any.fieldName
- key.InvalidDefinitionException
- any is not a map, value is not a sequence or error accessing any.public static boolean getBoolean(AnyMap any, java.lang.String fieldName, boolean defaultValue) throws InvalidDefinitionException
any
- a map any.fieldName
- key.defaultValue
- value to return if key is not set.InvalidDefinitionException
- any is not a map, value is not a boolean or error accessing any.public static ValueExpression getValueExpressionRequired(AnyMap any, java.lang.String fieldName) throws InvalidDefinitionException
#getValueExpression(Any, String)
, but throw an exception if the field does not exists.any
- a map any.fieldName
- key.InvalidDefinitionException
- any is not a map, value does not exists or is not a string or error accessing any.public static java.lang.String getStringRequired(AnyMap any, java.lang.String fieldName) throws InvalidDefinitionException
#getString(Any, String)
, but throw an exception if the field does not exists.any
- a map any.fieldName
- key.InvalidDefinitionException
- any is not a map, value does not exists or is not a string or error accessing any.public static java.lang.String getValidName(AnyMap any, java.lang.String fieldName) throws InvalidDefinitionException
#getStringRequired(Any, String)
, but throw an exception if value is not a valid name accoring to
NameValidator
.any
- a map any.fieldName
- key.InvalidDefinitionException
- any is not a map, value does not exists or is not a string or not valid or error accessing any.public static java.util.List<java.lang.String> getStringSeq(AnyMap any, java.lang.String fieldName) throws InvalidDefinitionException
any
- a map any.fieldName
- key.InvalidDefinitionException
- any is not a map, value is not an sequence of strings or error accessing any.