public class Capabilities extends Object
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.Modifier and Type | Field and Description |
---|---|
static Capabilities |
LOGICAL
Support for logical types AND, OR and NOT
|
static Capabilities |
LOGICAL_OPENGIS |
static Capabilities |
SIMPLE_COMPARISONS
Capabilities representing the simple comparisions.
|
static Capabilities |
SIMPLE_COMPARISONS_OPENGIS |
Constructor and Description |
---|
Capabilities() |
Capabilities(FilterCapabilities contents) |
Modifier and Type | Method and Description |
---|---|
void |
addAll(Capabilities copy) |
void |
addAll(FilterCapabilities copy) |
void |
addName(String name)
Adds support for the provided name.
|
void |
addName(String name,
int argumentCount)
Will add support for a function with the provided number of arguments
This method will have no effect if the function is already listed.
|
void |
addName(String name,
String... argumentNames)
Document support for the provided function.
|
void |
addType(Class type)
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.
|
FilterCapabilitiesImpl |
getContents()
Returns the internal FilterCapabilities data structure used for checking.
|
boolean |
supports(Filter filter)
Determines if specific filter passed in is supported.
|
String |
toOperationName(Class filterType)
Figure out the OperationName for the provided filterType.
|
String |
toOperationName(Filter filter)
Quickly look at the filter and determine the OperationName we need to check for in the
FilterCapabilities data structure.
|
public static Capabilities LOGICAL
public static Capabilities LOGICAL_OPENGIS
public static Capabilities SIMPLE_COMPARISONS
public static Capabilities SIMPLE_COMPARISONS_OPENGIS
public Capabilities()
public Capabilities(FilterCapabilities contents)
public FilterCapabilitiesImpl getContents()
public void addType(Class type)
This is the same as:addName( toOperationName( type ) )
type
- the Class that indicates the new support.public void addName(String name)
If this is a known name (avaialble as part of opengis interface) it will be grouped into:
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()
name
- FilterCapabilities Operand name such as "BBOX", "Like" or "MUL"public void addName(String name, int argumentCount)
This method will have no effect if the function is already listed.
Example:capabilities.addName( "Length", 1 )
name
- argumentCount
- public void addName(String name, String... argumentNames)
This method will have no effect if the function is already listed.
Example:capabilities.addName( "Min", "value1", "value2" )
name
- argumentCount
- public boolean supports(Filter filter)
filter
- The Filter to be tested.IsSupportedFilterVisitor
public boolean fullySupports(Filter filter)
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.
filter
- the filter to be tested.IsFullySupportedFilterVisitor
public boolean fullySupports(Expression expression)
The Expression visitor used for this work can handle null, even so care should be taken to useExpression.NIL where you can.
filter
- the filter to be tested.IsFullySupportedFilterVisitor
public String toOperationName(Filter filter)
filter
- public String toOperationName(Class 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.
filterType
- Filter typepublic void addAll(Capabilities copy)
public void addAll(FilterCapabilities copy)
Copyright © 1996–2019 Geotools. All rights reserved.