Class LeafExpression.Literal<R,V>

java.lang.Object
org.apache.sis.internal.filter.Node
org.apache.sis.filter.LeafExpression<R,V>
org.apache.sis.filter.LeafExpression.Literal<R,V>
Type Parameters:
R - the type of resources used as inputs.
V - the type of value computed by the expression.
All Implemented Interfaces:
Serializable, Function<R,V>, Expression<R,V>, FeatureExpression<R,V>, Literal<R,V>
Direct Known Subclasses:
LeafExpression.Transformed
Enclosing class:
LeafExpression<R,V>

static class LeafExpression.Literal<R,V> extends LeafExpression<R,V> implements Literal<R,V>
A constant, literal value that can be used in expressions. The apply(Object) method ignores the argument and always returns getValue().
  • Field Details

  • Constructor Details

    • Literal

      Literal(V value)
      Creates a new literal holding the given constant value.
  • Method Details

    • getChildren

      protected Collection<?> getChildren()
      Specified by:
      getChildren in class Node
      Returns:
      the children of this node, or an empty collection if none.
    • getValue

      public V getValue()
      Returns the constant value held by this object.
      Specified by:
      getValue in interface Literal<R,V>
    • getValueClass

      public Class<?> getValueClass()
      Returns the type of values computed by this expression.
      Specified by:
      getValueClass in interface FeatureExpression<R,V>
      Returns:
      the type of values computed by this expression.
    • apply

      public V apply(Object ignored)
      Expression evaluation, which just returns the constant value.
      Specified by:
      apply in interface Expression<R,V>
      Specified by:
      apply in interface Function<R,V>
      Parameters:
      ignored - the object to be evaluated by the expression. Can be null if this expression allows null values.
      Returns:
      value computed by the expression.
    • toValueType

      public <N> Expression<R,N> toValueType(Class<N> target)
      Returns an expression that provides values as instances of the specified class.
      Specified by:
      toValueType in interface Expression<R,V>
      Type Parameters:
      N - compile-time value of type.
      Parameters:
      target - desired type of expression results.
      Returns:
      expression doing the same operation this this expression but with results of the specified type.
      Throws:
      ClassCastException - if values cannot be provided as instances of the specified class.
    • expectedType

      public PropertyTypeBuilder expectedType(DefaultFeatureType ignored, FeatureTypeBuilder addTo)
      Provides the type of values returned by apply(Object) wrapped in an DefaultAttributeType named "Literal".
      Specified by:
      expectedType in interface FeatureExpression<R,V>
      Parameters:
      ignored - the type of features to be evaluated by the given expression.
      addTo - where to add the type of properties evaluated by the given expression.
      Returns:
      builder of the added property.
    • newType

      private static <R> DefaultAttributeType<R> newType(Class<R> standardType)
      Invoked when a new attribute type need to be created for the given standard type. The given standard type should be a GeoAPI interface, not the implementation class.