Package org.apache.sis.filter
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>
A constant, literal value that can be used in expressions.
The
apply(Object) method ignores the argument and always returns getValue().-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.sis.filter.LeafExpression
LeafExpression.Literal<R,V>, LeafExpression.Transformed<R, V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final longFor cross-version compatibility.private static final WeakValueHashMap<Class<?>,DefaultAttributeType<?>> A cache ofDefaultAttributeTypeinstances for literal classes.protected final VThe constant value to be returned bygetValue(). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionExpression evaluation, which just returns the constant value.expectedType(DefaultFeatureType ignored, FeatureTypeBuilder addTo) Provides the type of values returned byapply(Object)wrapped in anDefaultAttributeTypenamed "Literal".protected Collection<?>getValue()Returns the constant value held by this object.Class<?>Returns the type of values computed by this expression.private static <R> DefaultAttributeType<R>Invoked when a new attribute type need to be created for the given standard type.<N> Expression<R,N> toValueType(Class<N> target) Returns an expression that provides values as instances of the specified class.Methods inherited from class org.apache.sis.filter.LeafExpression
getParametersMethods inherited from class org.apache.sis.internal.filter.Node
createName, createType, equals, getGeometryLibrary, hashCode, symbol, toGeometryWrapper, toString, unwrap, warningMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.sis.internal.geoapi.filter.Literal
getFunctionName, getParameters
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
value
The constant value to be returned bygetValue(). -
TYPES
A cache ofDefaultAttributeTypeinstances for literal classes. Used for avoiding to create duplicated instances when the literal is a common type likeStringorInteger.
-
-
Constructor Details
-
Literal
Literal(V value) Creates a new literal holding the given constant value.
-
-
Method Details
-
getChildren
- Specified by:
getChildrenin classNode- Returns:
- the children of this node, or an empty collection if none.
-
getValue
Returns the constant value held by this object. -
getValueClass
Returns the type of values computed by this expression.- Specified by:
getValueClassin interfaceFeatureExpression<R,V> - Returns:
- the type of values computed by this expression.
-
apply
Expression evaluation, which just returns the constant value. -
toValueType
Returns an expression that provides values as instances of the specified class.- Specified by:
toValueTypein interfaceExpression<R,V> - Type Parameters:
N- compile-time value oftype.- 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
Provides the type of values returned byapply(Object)wrapped in anDefaultAttributeTypenamed "Literal".- Specified by:
expectedTypein interfaceFeatureExpression<R,V> - Parameters:
addTo- where to add the type of properties evaluated by the given expression.ignored- the type of features to be evaluated by the given expression.- Returns:
- builder of the added property.
-
newType
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.
-