Class Value
java.lang.Object
software.amazon.smithy.rulesengine.language.evaluation.value.Value
- All Implemented Interfaces:
FromSourceLocation
,ToNode
- Direct Known Subclasses:
ArrayValue
,BooleanValue
,EmptyValue
,EndpointValue
,IntegerValue
,RecordValue
,StringValue
An abstract representing a typed value.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ArrayValue
arrayValue
(List<Value> value) Creates anArrayValue
from a list of values.static BooleanValue
booleanValue
(boolean value) Creates anBooleanValue
from a boolean.static EmptyValue
Creates anEmptyValue
.static EndpointValue
endpointValue
(Node source) Creates anEndpointValue
from a node.Returns the current value as anArrayValue
, throwingRuntimeException
when the value is the wrong type.Returns the current value as anArrayValue
, throwingRuntimeException
when the value is the wrong type.Returns the current value as anArrayValue
, throwingRuntimeException
when the value is the wrong type.Returns the current value as anArrayValue
, throwingRuntimeException
when the value is the wrong type.Returns the current value as anArrayValue
, throwingRuntimeException
when the value is the wrong type.Returns the current value as anArrayValue
, throwingRuntimeException
when the value is the wrong type.static Value
Creates aValue
of a specific type from the given Node information.Gets the source location of a value.abstract Type
getType()
static IntegerValue
integerValue
(int value) Creates anIntegerValue
from an integer.boolean
isEmpty()
static RecordValue
recordValue
(Map<Identifier, Value> value) Creates anRecordValue
from a map of identifiers to values.static StringValue
stringValue
(String value) Creates anStringValue
from a string.
-
Method Details
-
getType
-
fromNode
Creates aValue
of a specific type from the given Node information.- Parameters:
source
- the node to deserialize.- Returns:
- the created Value.
-
isEmpty
public boolean isEmpty() -
getSourceLocation
Description copied from interface:FromSourceLocation
Gets the source location of a value.- Specified by:
getSourceLocation
in interfaceFromSourceLocation
- Returns:
- Returns the source location of the value.
-
arrayValue
Creates anArrayValue
from a list of values.- Parameters:
value
- the list of values for the array.- Returns:
- returns the created ArrayValue.
-
booleanValue
Creates anBooleanValue
from a boolean.- Parameters:
value
- the value for the boolean.- Returns:
- returns the created BooleanValue.
-
emptyValue
Creates anEmptyValue
.- Returns:
- returns the created EmptyValue.
-
endpointValue
Creates anEndpointValue
from a node.- Parameters:
source
- the node to create an endpoint from.- Returns:
- returns the created EndpointValue.
-
integerValue
Creates anIntegerValue
from an integer.- Parameters:
value
- the value for the integer.- Returns:
- returns the created IntegerValue.
-
recordValue
Creates anRecordValue
from a map of identifiers to values.- Parameters:
value
- the map to create a record from.- Returns:
- returns the created RecordValue.
-
stringValue
Creates anStringValue
from a string.- Parameters:
value
- the value for the string.- Returns:
- returns the created StringValue.
-
expectArrayValue
Returns the current value as anArrayValue
, throwingRuntimeException
when the value is the wrong type.- Returns:
- returns an array value.
-
expectBooleanValue
Returns the current value as anArrayValue
, throwingRuntimeException
when the value is the wrong type.- Returns:
- returns a boolean value.
-
expectEndpointValue
Returns the current value as anArrayValue
, throwingRuntimeException
when the value is the wrong type.- Returns:
- returns an endpoint value
-
expectIntegerValue
Returns the current value as anArrayValue
, throwingRuntimeException
when the value is the wrong type.- Returns:
- returns an integer value.
-
expectRecordValue
Returns the current value as anArrayValue
, throwingRuntimeException
when the value is the wrong type.- Returns:
- returns a record value.
-
expectStringValue
Returns the current value as anArrayValue
, throwingRuntimeException
when the value is the wrong type.- Returns:
- returns a string value.
-