- All Implemented Interfaces:
JsonSerializable
An ArcadeExpression object gathers an Arcade script expression together with:
- the expected return type
- the name that a map author uses to refer to it
- the title that the author uses to describe the expression.
- Since:
- 100.11.0
-
Constructor Summary
ConstructorDescriptionArcadeExpression
(String expression) Creates a new ArcadeExpression object with an expression script.ArcadeExpression
(String expression, String title, String name) Creates a new ArcadeExpression object.ArcadeExpression
(String expression, String title, String name, ArcadeExpressionReturnType returnType) Creates a new ArcadeExpression object. -
Method Summary
Modifier and TypeMethodDescriptionboolean
equals
(ArcadeExpression other) Tests if this object is equal to a second ArcadeExpression object.static ArcadeExpression
Creates an ArcadeExpression instance from a JSON string.Gets the Arcade expression string.getName()
Gets the name that the author uses to refer to the expression.Gets the expected return type of the expression.getTitle()
Gets the title that the author uses to describe the expression.Gets unknown data from the source JSON.Gets unsupported data from the source JSON.toJson()
Serializes this object to a JSON string.
-
Constructor Details
-
ArcadeExpression
Creates a new ArcadeExpression object with an expression script.The
getName()
andgetTitle()
will default to empty strings. ThegetReturnType()
will default toArcadeExpressionReturnType.AUTOMATIC
.- Parameters:
expression
- the Arcade expression to be evaluated; if set to an empty expression string then the evaluation will return null.- Throws:
IllegalArgumentException
- if expression is null- Since:
- 100.11.0
-
ArcadeExpression
Creates a new ArcadeExpression object.The
getReturnType()
will default toArcadeExpressionReturnType.AUTOMATIC
.- Parameters:
expression
- the Arcade expression to be evaluated; if set to an empty expression string then the evaluation will return null.title
- the title of the expressionname
- the name of the expression- Throws:
IllegalArgumentException
- if expression is nullIllegalArgumentException
- if title is nullIllegalArgumentException
- if name is null- Since:
- 100.11.0
-
ArcadeExpression
public ArcadeExpression(String expression, String title, String name, ArcadeExpressionReturnType returnType) Creates a new ArcadeExpression object.If set to an empty expression string then the evaluation will calculate zero, an empty string, or null, depending on whether the
ArcadeExpressionReturnType
is one of the following:ArcadeExpressionReturnType.NUMBER
,ArcadeExpressionReturnType.STRING
,ArcadeExpressionReturnType.AUTOMATIC
,ArcadeExpressionReturnType.ANY
,ArcadeExpressionReturnType.BOOLEAN
.- Parameters:
expression
- the Arcade expression to be evaluated. If set to an empty expression string, then the evaluation will return zero, false, an empty string, or null, depending on whether the returnType isArcadeExpressionReturnType.NUMBER
,ArcadeExpressionReturnType.BOOLEAN
,ArcadeExpressionReturnType.STRING
or anything else, respectively.title
- the title of the expressionname
- the name of the expressionreturnType
- If the Arcade expression creates results of a different type (e.g., a Date or an Array), then the result will be cast to the expected return type. If no sensible cast can be carried out, then the result will be null.- Throws:
IllegalArgumentException
- if expression is nullIllegalArgumentException
- if title is nullIllegalArgumentException
- if name is nullIllegalArgumentException
- if returnType is null- Since:
- 100.11.0
-
-
Method Details
-
getExpression
Gets the Arcade expression string.- Returns:
- the Arcade expression string
- Since:
- 100.11.0
-
getName
Gets the name that the author uses to refer to the expression.If not set explicitly, then the default is an empty string.
- Returns:
- the name of the expression
- Since:
- 100.11.0
-
getReturnType
Gets the expected return type of the expression.If the arcade expression evaluates to a result which differs from
ArcadeExpressionReturnType
then the result will be cast to the expected return type. If the cast cannot be carried out, the result will be a type-specific error value. SeeArcadeExpressionReturnType
for details.- Returns:
- the expected return type of the expression
- Since:
- 100.11.0
-
getTitle
Gets the title that the author uses to describe the expression.If not set explicitly, then the default is an empty string.
- Returns:
- the title
- Since:
- 100.11.0
-
equals
Tests if this object is equal to a second ArcadeExpression object.- Parameters:
other
- the second object- Returns:
- true if the comparison succeeds and the objects are equal, false otherwise
- Since:
- 100.11.0
-
fromJson
Creates an ArcadeExpression instance from a JSON string.- Parameters:
json
- a JSON string that represents an ArcadeExpression- Returns:
- an ArcadeExpression instance
- Throws:
IllegalArgumentException
- if json is null or empty- Since:
- 100.11.0
-
toJson
Description copied from interface:JsonSerializable
Serializes this object to a JSON string. Note that unknown JSON is omitted from the serialized string.- Specified by:
toJson
in interfaceJsonSerializable
- Returns:
- a JSON string
-
getUnknownJson
Description copied from interface:JsonSerializable
Gets unknown data from the source JSON.Unknown JSON is a Map of values not defined in the ArcGIS specification used to create this object but found in the source JSON. If the object is written back to JSON, any unknown JSON data is not persisted. The ArcGIS specification may be for a web map, web scene, REST API, and so on.
- Specified by:
getUnknownJson
in interfaceJsonSerializable
- Returns:
- an unmodifiable Map containing unknown data from the source JSON
-
getUnsupportedJson
Description copied from interface:JsonSerializable
Gets unsupported data from the source JSON.Unsupported JSON is a Map of values defined in the ArcGIS specification used to create this object but not currently used in this API. If the object is written back to JSON, any unsupported JSON data is persisted. The ArcGIS specification may be from a web map, web scene, REST API, and so on.
- Specified by:
getUnsupportedJson
in interfaceJsonSerializable
- Returns:
- an unmodifiable Map containing unsupported data from the source JSON
-