Package org.apache.sis.internal.feature
Interface FeatureExpression<R,V>
- Type Parameters:
R
- the type of resources (e.g.Feature
) used as inputs.V
- the type of values computed by the expression.
- All Superinterfaces:
Expression<R,
,V> Function<R,
V>
- All Known Implementing Classes:
ArithmeticFunction
,ArithmeticFunction.Add
,ArithmeticFunction.Divide
,ArithmeticFunction.Multiply
,ArithmeticFunction.Subtract
,AssociationValue
,ConvertFunction
,FunctionWithSRID
,GeometryConstructor
,GeometryParser
,LeafExpression
,LeafExpression.Literal
,LeafExpression.Transformed
,OneGeometry
,OneGeometry.WithArgument
,PropertyValue
,PropertyValue.AsObject
,PropertyValue.CastedAndConverted
,PropertyValue.Converted
,SpatialFunction
,ST_FromBinary
,ST_FromText
,ST_Point
,ST_Transform
,TwoGeometries
,TwoGeometries.WithArgument
OGC expressions or other functions operating on feature instances.
This interface adds an additional method,
expectedType(FeatureType, FeatureTypeBuilder)
,
for fetching in advance the expected type of expression results.
This is an experimental interface which may be removed in any future version.
- Since:
- 1.0
- Version:
- 1.2
-
Method Summary
Modifier and TypeMethodDescriptionstatic FeatureExpression<?,
?> castOrCopy
(Expression<?, ?> candidate) Tries to cast or convert the given expression to aFeatureExpression
.expectedType
(DefaultFeatureType valueType, FeatureTypeBuilder addTo) Provides the expected type of values produced by this expression when a feature of the given type is evaluated.default Class<?>
Returns the type of values computed by this expression, orObject.class
if unknown.Methods inherited from interface org.apache.sis.filter.Expression
apply, getFunctionName, getParameters, toValueType
-
Method Details
-
getValueClass
Returns the type of values computed by this expression, orObject.class
if unknown.- Returns:
- the type of values computed by this expression.
-
expectedType
Provides the expected type of values produced by this expression when a feature of the given type is evaluated. The resulting type shall describe a "static" property, i.e. it can be anAttributeType
or aorg.opengis.feature.FeatureAssociationRole
but not anorg.opengis.feature.Operation
.- Parameters:
valueType
- the type of features to be evaluated by the given expression.addTo
- where to add the type of properties evaluated by this expression.- Returns:
- builder of the added property, or
null
if this method cannot add a property. - Throws:
IllegalArgumentException
- if this method can operate only on some feature types and the given type is not one of them.
-
castOrCopy
Tries to cast or convert the given expression to aFeatureExpression
. If the given expression cannot be casted, then this method creates a copy provided that the expression is one of the following type:Literal
.ValueReference
, assuming that the expression expects feature instances.
null
. It is caller's responsibility to verify if this method returnsnull
and to throw an exception in such case. We leave that responsibility to the caller because (s)he may be able to provide better error messages.- Parameters:
candidate
- the expression to cast or copy. Can be null.- Returns:
- the given expression as a feature expression, or
null
if it cannot be casted or converted.
-