Class ExpressionValue

java.lang.Object
com.luciad.expressions.ExpressionValue
All Implemented Interfaces:
AutoCloseable

public final class ExpressionValue extends Object implements AutoCloseable
Value object to store the value of an Expression and its DataType.

Users of this value object always must check the type of value stored and then call the appropriate method to retrieve the actual value.

  • Constructor Details

    • ExpressionValue

      public ExpressionValue(float value)
      Constructs the value object for a number value.

      The type of the value is DataType#getFloatType().

      Parameters:
      value - the number.
    • ExpressionValue

      public ExpressionValue(double value)
      Constructs the value object for a number value.

      The type of the value is DataType#getDoubleType().

      Parameters:
      value - the number.
    • ExpressionValue

      public ExpressionValue(int value)
      Constructs the value object for an integer value.

      The type of the value is DataType#getIntType().

      Parameters:
      value - the number.
    • ExpressionValue

      public ExpressionValue(long value)
      Constructs the value object for a long integer (64 bit) value.

      The type of the value is DataType#getLongType().

      Parameters:
      value - the number.
    • ExpressionValue

      public ExpressionValue(boolean value)
      Constructs the value object for a boolean value.

      The type of the value is DataType#getBooleanType().

      Parameters:
      value - the boolean.
    • ExpressionValue

      public ExpressionValue(@NotNull ExpressionValue other)
      Constructs a copy of other.
      Parameters:
      other - Instance of the ExpressionValue.
    • ExpressionValue

      public ExpressionValue(@NotNull String value)
      Constructs the value object for a text value.

      The type of the value is DataType#getStringType().

      Parameters:
      value - the text.
    • ExpressionValue

      public ExpressionValue(@NotNull Geometry value)
      Constructs the value object for a Geometry value.

      The type of the value is DataType#getGeometryType().

      Parameters:
      value - Geometry, cannot be null.
  • Method Details

    • finalize

      protected void finalize()
      Overrides:
      finalize in class Object
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • getDataType

      @NotNull public DataType getDataType()
      Returns the type of the value stored within this value object.
      Returns:
      the type of the value stored within this value object.
    • getFloatValue

      public float getFloatValue() throws IllegalStateException
      Returns the float value, if the value object contains a float.
      Returns:
      the float value, if the value object contains a float.
      Throws:
      IllegalStateException - when the object does not contain a float.
    • getDoubleValue

      public double getDoubleValue() throws IllegalStateException
      Returns the double value, if the value object contains a double.
      Returns:
      the double value, if the value object contains a double.
      Throws:
      IllegalStateException - when the object does not contain a double.
    • getIntValue

      public int getIntValue() throws IllegalStateException
      Returns the int value, if the value object contains an int.
      Returns:
      the int value, if the value object contains an int.
      Throws:
      IllegalStateException - when the object does not contain an int.
    • getLongValue

      public long getLongValue() throws IllegalStateException
      Returns the long integer value, if the value object contains a long int.
      Returns:
      the long integer value, if the value object contains a long int.
      Throws:
      IllegalStateException - when the object does not contain a long int.
    • getBoolValue

      public boolean getBoolValue() throws IllegalStateException
      Returns the boolean value, if the value object contains a boolean.
      Returns:
      the boolean value, if the value object contains a boolean.
      Throws:
      IllegalStateException - when the object does not contain a boolean.
    • getStringValue

      @NotNull public String getStringValue() throws IllegalStateException
      Returns the string value, if the value object contains a string.
      Returns:
      the string value, if the value object contains a string.
      Throws:
      IllegalStateException - when the object does not contain a string.
    • getGeometryValue

      @NotNull public Geometry getGeometryValue() throws IllegalStateException
      Returns the geometry value, if the value object contains a geometry.
      Returns:
      the geometry value, if the value object contains a geometry.
      Throws:
      IllegalStateException - when the object does not contain a geometry.
    • asDouble

      @Nullable public Double asDouble()
      Returns the double value, if the value object can be converted to a double.
      Returns:
      the double value, if the value object can be converted to a double.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(@Nullable Object other)
      Overrides:
      equals in class Object