Package org.apache.sis.filter
Class PropertyValue<V>
- Type Parameters:
V- the type of value computed by the expression.
- All Implemented Interfaces:
Serializable,Function<AbstractFeature,,V> Expression<AbstractFeature,,V> Optimization.OnExpression<AbstractFeature,,V> FeatureExpression<AbstractFeature,,V> ValueReference<AbstractFeature,V>
- Direct Known Subclasses:
PropertyValue.AsObject,PropertyValue.Converted
abstract class PropertyValue<V>
extends LeafExpression<AbstractFeature,V>
implements ValueReference<AbstractFeature,V>, Optimization.OnExpression<AbstractFeature,V>
Expression whose value is computed by retrieving the value indicated by the provided name.
This expression does not store any value; it acts as an indirection to a property value of
the evaluated feature.
- Since:
- 1.1
- Version:
- 1.2
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classAn expression fetching property values asObject.private static final classAn expression fetching property values as an object of specified type.private static classAn expression fetching property values as an object of specified type.Nested classes/interfaces inherited from class org.apache.sis.filter.LeafExpression
LeafExpression.Literal<R,V>, LeafExpression.Transformed<R, V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final booleanWhether the property to fetch is considered virtual (a property that may be defined only in sub-types).protected final StringName of the property from which to retrieve the value.private static final longFor cross-version compatibility.(package private) static final StringThe prefix in a x-path for considering a property as virual. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPropertyValue(String name, boolean isVirtual) Creates a new expression retrieving values from a property of the given name. -
Method Summary
Modifier and TypeMethodDescription(package private) static <V> ValueReference<AbstractFeature,V> Creates a new expression retrieving values from a property of the given path.(package private) final PropertyTypeBuilderexpectedType(FeatureTypeBuilder addTo) Returns the default value ofexpectedType(FeatureType, FeatureTypeBuilder)when it cannot be inferred by the analysis of the givenFeatureType.expectedType(DefaultFeatureType valueType, FeatureTypeBuilder addTo) Provides the expected type of values produced by this expression when a feature of the given type is evaluated.protected final Collection<?>final org.opengis.util.ScopedNameReturns the name of the function to be called.protected Class<?>Returns the type of values fetched fromAbstractFeatureinstance.final StringgetXPath()Returns the name of the property whose value will be returned by theExpression.apply(Object)method.abstract PropertyValue<V>optimize(Optimization optimization) If the evaluated property is a link, replaces this expression by a more direct reference to the target property.final <N> PropertyValue<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.filter.Expression
apply, getParametersMethods inherited from interface org.apache.sis.internal.feature.FeatureExpression
getValueClassMethods inherited from interface org.apache.sis.filter.Optimization.OnExpression
recreate
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
name
Name of the property from which to retrieve the value. This is the argument to give in calls toFeature#getProperty(String) -
isVirtual
protected final boolean isVirtualWhether the property to fetch is considered virtual (a property that may be defined only in sub-types). Iftrue, thenexpectedType(FeatureType, FeatureTypeBuilder)will not throw an exception if the property is not found. -
VIRTUAL_PREFIX
The prefix in a x-path for considering a property as virual.- See Also:
-
-
Constructor Details
-
PropertyValue
Creates a new expression retrieving values from a property of the given name.
-
-
Method Details
-
getFunctionName
public final org.opengis.util.ScopedName getFunctionName()Description copied from interface:ExpressionReturns the name of the function to be called.- Specified by:
getFunctionNamein interfaceExpression<AbstractFeature,V> - Returns:
- name of the function to be called.
-
create
Creates a new expression retrieving values from a property of the given path. Simple path expressions of the form "a/b/c" can be used.- Type Parameters:
V- compile-time value oftype.- Parameters:
xpath- path (usually a single name) of the property to fetch.type- the desired type for the expression result.- Returns:
- expression retrieving values from a property of the given name.
- Throws:
IllegalArgumentException- if the given XPath is not supported.
-
getChildren
- Specified by:
getChildrenin classNode- Returns:
- the children of this node, or an empty collection if none.
-
getXPath
Returns the name of the property whose value will be returned by theExpression.apply(Object)method.- Specified by:
getXPathin interfaceValueReference<AbstractFeature,V>
-
getSourceClass
Returns the type of values fetched fromAbstractFeatureinstance. This is the type before conversion to the target type. The type is alwaysObjecton newly created expression because the type of feature property values is unknown, but may become a specialized type afterOptimizationhas been applied. -
expectedType
Returns the default value ofexpectedType(FeatureType, FeatureTypeBuilder)when it cannot be inferred by the analysis of the givenFeatureType. -
toValueType
Returns an expression that provides values as instances of the specified class.- Specified by:
toValueTypein interfaceExpression<AbstractFeature,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.
-
optimize
If the evaluated property is a link, replaces this expression by a more direct reference to the target property. This optimization is important for allowingSQLStoreto put the column name in the SQLWHEREclause. It makes the difference between using or not the database index.- Specified by:
optimizein interfaceOptimization.OnExpression<AbstractFeature,V> - Parameters:
optimization- the simplifications or optimizations to apply on this expression.- Returns:
- the simplified or optimized expression, or
thisif no optimization has been applied.
-
expectedType
Provides the expected type of values produced by this expression when a feature of the given type is evaluated.- Specified by:
expectedTypein interfaceFeatureExpression<AbstractFeature,V> - Parameters:
valueType- 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, or
nullif this method cannot add a property. - Throws:
IllegalArgumentException- if this method cannot determine the property type for the given feature type.
-