Class ArcadeExpression

  • All Implemented Interfaces:
    JsonSerializable

    public final class ArcadeExpression
    extends Object
    implements JsonSerializable
    An Arcade expression, containing an expression, a name, a return type and a title.

    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
    • Method Detail

      • getExpression

        public String getExpression()
        Gets the Arcade expression string.
        Returns:
        the Arcade expression string
        Since:
        100.11.0
      • getName

        public String 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

        public ArcadeExpressionReturnType getReturnType()
        Gets the expected return type of the expression.

        If the arcade expression creates results of a different type (for example, 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.

        Returns:
        the expected return type of the expression
        Since:
        100.11.0
      • getTitle

        public String 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

        public boolean equals​(ArcadeExpression other)
        Tests if two ArcadeExpression objects are equal.
        Parameters:
        other - the second object
        Returns:
        true if this ArcadeExpression and the other ArcadeExpression are equivalent, false if they are not
        Since:
        100.11.0
      • fromJson

        public static ArcadeExpression fromJson​(String json)
        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

        public String 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 interface JsonSerializable
        Returns:
        a JSON string
      • getUnknownJson

        public Map<String,​Object> getUnknownJson()
        Description copied from interface: JsonSerializable
        If this object was created from JSON, this method gets unknown data from the source JSON. Unknown JSON is a Map of values that were in the source JSON but are not known by the Runtime and therefore not exposed in the API.
        Specified by:
        getUnknownJson in interface JsonSerializable
        Returns:
        an unmodifiable Map containing unknown JSON data. The keys are Strings containing names. The types of the values depend on the types of tokens within the JSON as follows:
        • a Map<String, Object> represents an object in the JSON
        • a List<Object> represents an array in the JSON
        • a String represents a string in the JSON
        • a Double represents a number in the JSON
        • a Boolean represents true or false in the JSON
        • null represents null in the JSON
      • getUnsupportedJson

        public Map<String,​Object> getUnsupportedJson()
        Description copied from interface: JsonSerializable
        If this object was created from JSON, this method gets unsupported data from the source JSON. Unsupported JSON is a Map of values that are supported by webmaps and known to the version of the webmap specification the API supports (see system requirements), but are not explicitly exposed through the Runtime API.
        Specified by:
        getUnsupportedJson in interface JsonSerializable
        Returns:
        an unmodifiable Map containing unsupported JSON data. The keys are Strings containing names. The types of the values depend on the types of tokens within the JSON as follows:
        • a Map<String, Object> represents an object in the JSON
        • a List<Object> represents an array in the JSON
        • a String represents a string in the JSON
        • a Double represents a number in the JSON
        • a Boolean represents true or false in the JSON
        • null represents null in the JSON