Package org.apache.sis.filter
Class LeafExpression.Transformed<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>
org.apache.sis.filter.LeafExpression.Transformed<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> Optimization.OnExpression<R,
,V> FeatureExpression<R,
,V> Literal<R,
V>
- Enclosing class:
- LeafExpression<R,
V>
static final class LeafExpression.Transformed<R,V>
extends LeafExpression.Literal<R,V>
implements Optimization.OnExpression<R,V>
A literal value which is the result of transforming another literal.
-
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 TypeFieldDescription(package private) final Expression<R,
?> The original expression.private static final long
For cross-version compatibility.Fields inherited from class org.apache.sis.filter.LeafExpression.Literal
value
-
Constructor Summary
ConstructorsConstructorDescriptionTransformed
(V value, Expression<R, ?> original) Creates a new literal holding the given constant value. -
Method Summary
Modifier and TypeMethodDescriptionExpression<? super R,
? extends V> optimize
(Optimization optimization) Returns the same literal without the reference to the original expression.<N> Expression<R,
N> toValueType
(Class<N> target) Converts the transformed value if possible, or the original value as a fallback.Methods inherited from class org.apache.sis.filter.LeafExpression.Literal
apply, expectedType, getChildren, getValue, getValueClass
Methods inherited from class org.apache.sis.filter.LeafExpression
getParameters
Methods inherited from class org.apache.sis.internal.filter.Node
createName, createType, equals, getGeometryLibrary, hashCode, symbol, toGeometryWrapper, toString, unwrap, warning
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.sis.filter.Expression
apply
Methods inherited from interface org.apache.sis.internal.geoapi.filter.Literal
getFunctionName, getParameters
Methods inherited from interface org.apache.sis.filter.Optimization.OnExpression
recreate
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
original
The original expression.
-
-
Constructor Details
-
Transformed
Transformed(V value, Expression<R, ?> original) Creates a new literal holding the given constant value.
-
-
Method Details
-
optimize
Returns the same literal without the reference to the original expression. Since thisTransformed
instance will not longer be unwrapped, the transformed value will become visible to users.- Specified by:
optimize
in interfaceOptimization.OnExpression<R,
V> - Parameters:
optimization
- the simplifications or optimizations to apply on this expression.- Returns:
- the simplified or optimized expression, or
this
if no optimization has been applied.
-
toValueType
Converts the transformed value if possible, or the original value as a fallback.- Specified by:
toValueType
in interfaceExpression<R,
V> - Overrides:
toValueType
in classLeafExpression.Literal<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.
-