Class QueryWhereHandler<C>
java.lang.Object
com.sodius.oslc.server.process.query.QueryWhereHandler<C>
- Type Parameters:
C- the type of context, which is used byterm handlersto report processing outputs
Handles the terms found in an
oslc.where expression.
This is for visiting the terms, identifying the OSLC properties used and delegating to specific term handlers
for a given context.
The context is whatever provides information about the underlying application to term handlers
and what may receive their processing output.
An naive example of handler can be:
private static class MyQueryWhereTermHandler<T> extends QueryWhereTermHandler<T, StringBuilder> {
private MyQueryWhereTermHandler(String propertyDefinition, Class<T> type) {
super(propertyDefinition, type);
}
protected void handle(String property, Operator operator, T value, StringBuilder buffer) {
buffer.append("Found " + property + " using " + operator + " and " + value);
}
};
...
QueryWhereHandler<StringBuilder> whereHandler = new QueryWhereHandler<>(Arrays.asList(
new MyQueryWhereTermHandler<>(Dcterms.PROPERTY_TITLE, String.class),
new MyQueryWhereTermHandler<>(Dcterms.PROPERTY_IDENTIFIER, String.class)));
StringBuilder buffer = new StringBuilder();
whereHandler.apply(whereClause, buffer);
System.out.println(buffer.toString());
- Since:
- 3.6.0
-
Constructor Summary
ConstructorsConstructorDescriptionQueryWhereHandler(Collection<QueryWhereTermHandler<?, C>> handlers) Creates a new instance using the given term handlers. -
Method Summary
Modifier and TypeMethodDescriptionvoidhandle(WhereClause whereClause, C context) Process anoslc.whereexpression in a given context.
-
Constructor Details
-
QueryWhereHandler
Creates a new instance using the given term handlers.- Parameters:
handlers- the term handlers
-
-
Method Details
-
handle
Process anoslc.whereexpression in a given context.The context is whatever provides information about the underlying application to term handlers and what may receive their processing output.
- Parameters:
whereClause- the parsed where expressioncontext- the context that can receive where terms processing output- Throws:
WebApplicationException- if a term, property, operator or value is not supported- See Also:
-