Class Capabilities
This class provides some out of the box FilterCapabilities constants that you can quickly use to describe the encoding abilities of your service.
This class behaves similar to Citations in that the constants are to be considered immutable, methods have been provided to assist in composing your own set of FilterCapabilities.
Example:
Capabilities capabilities = new Capabilities();
capabilities.addAll( Capabilities.LOGICAL );
capabilities.addAll( Capabilities.SIMPLE_COMPARISONS );
You can use the Capabilities class at runtime to check existing filters to see if they are fully supported:
if( fullySupports( filter )) {
// do something
}
Right now the class gives no indication as to what part of the provided filter was in error.- Author:
- Jody Garnett
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Capabilities
Support for logical types AND, OR and NOTstatic Capabilities
static Capabilities
Capabilities representing the simple comparisions.static Capabilities
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAll
(FilterCapabilities copy) void
addAll
(Capabilities copy) void
Adds support for the provided name.void
Will add support for a function with the provided number of argumentsvoid
Document support for the provided function.void
Adds a new support type to capabilities.boolean
fullySupports
(Expression expression) Determines if the expression and all its sub expressions is supported.boolean
fullySupports
(Filter filter) Determines if the filter and all its sub filters and expressions are supported.Returns the internal FilterCapabilities data structure used for checking.boolean
Determines if specific filter passed in is supported.toOperationName
(Class filterType) Figure out the OperationName for the provided filterType.toOperationName
(Filter filter) Quickly look at the filter and determine the OperationName we need to check for in the FilterCapabilities data structure.
-
Field Details
-
LOGICAL
Support for logical types AND, OR and NOT -
LOGICAL_OPENGIS
-
SIMPLE_COMPARISONS
Capabilities representing the simple comparisions. -
SIMPLE_COMPARISONS_OPENGIS
-
-
Constructor Details
-
Capabilities
public Capabilities() -
Capabilities
-
-
Method Details
-
getContents
Returns the internal FilterCapabilities data structure used for checking.- Returns:
- FilterCapabilities
-
addType
Adds a new support type to capabilities.This is the same as:
addName( toOperationName( type ) )
- Parameters:
type
- the Class that indicates the new support.
-
addName
Adds support for the provided name.If this is a known name (avaialble as part of opengis interface) it will be grouped into:
- Spatial Operators: Will added a SpatialOperator into the mix with Point, LineString, Polygon as the supported geometry operands (based on the assumption of JTS)
- Comparison Operators:
- Arithmetic Operators: will cause hassimpleArithmetic to be true
- Other: will be treated as a no argument function call
Examples:
capabilities.addName("Beyond"); // will enabled Beyond Filter capabilities.addName("NullCheck"); // will enable PropertyIsNull Filter capabilities.addName("SUB"); // will enabled hasSimpleArithmetic capabilities.addName("PI"); // add a no argument function called PI()
- Parameters:
name
- FilterCapabilities Operand name such as "BBOX", "Like" or "MUL"
-
addName
Will add support for a function with the provided number of argumentsThis method will have no effect if the function is already listed.
Example:
capabilities.addName( "Length", 1 )
-
addName
Document support for the provided function.This method will have no effect if the function is already listed.
Example:
capabilities.addName( "Min", "value1", "value2" )
-
supports
Determines if specific filter passed in is supported.- Parameters:
filter
- The Filter to be tested.- Returns:
- true if supported, false otherwise.
- See Also:
-
fullySupports
Determines if the filter and all its sub filters and expressions are supported.Is most important for logic filters, as they are the only ones with subFilters. The geoapi FilterVisitor and ExpressionVisitors allow for the handling of null, even so care should be taken to use Filter.INCLUDE and Expression.NIL where you can.
- Parameters:
filter
- the filter to be tested.- Returns:
- true if all sub filters are supported, false otherwise.
- See Also:
-
fullySupports
Determines if the expression and all its sub expressions is supported.The Expression visitor used for this work can handle null, even so care should be taken to useExpression.NIL where you can.
- Parameters:
expression
- the expression to be tested.- Returns:
- true if all sub filters are supported, false otherwise.
- See Also:
-
toOperationName
Quickly look at the filter and determine the OperationName we need to check for in the FilterCapabilities data structure.- Returns:
- Operation name
-
toOperationName
Figure out the OperationName for the provided filterType.The returned name can be used to check the FilterCapabilities to see if it type is supported in this execution context.
This approach is not applicable for Functions.
- Parameters:
filterType
- Filter type- Returns:
- Operation name for the provided FilterType
-
addAll
-
addAll
-