|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gcube.resources.discovery.client.queries.impl.QueryBox
org.gcube.resources.discovery.client.queries.impl.QueryTemplate
public class QueryTemplate
A Query that interpolates named parameters inside a template.
Templates are strings with empty XML elements, optionally with a DEFAULT attribute, e.g.:
all results that satisfy <cond1/> or <cond2 def='that'/> <extra/>
Whenever expression() is invoked, the elements in the template are replaced according to the first rule that applies
among the following:
DEFAULT attribute, if one exists
cond1="this", expression() returns:
all results that satisfy this or that
| Field Summary | |
|---|---|
static String |
DEFAULT
|
| Constructor Summary | |
|---|---|
QueryTemplate(String template)
Creates an instance with a template. |
|
QueryTemplate(String template,
Map<String,String> parameters)
Creates an instance with a template and an initial set of parameters. |
|
| Method Summary | |
|---|---|
void |
addParameter(String name,
String value)
Adds a parameter to the query, overwriting any value that it may already have. |
void |
appendParameter(String name,
String value)
Adds a parameter to the query, extending any value that it may already have. |
String |
expression()
Returns the textual expression of the query. |
boolean |
hasParameter(String name)
Returns true if the query has a given parameter. |
String |
parameter(String name)
Returns the current value of a parameter. |
| Methods inherited from class org.gcube.resources.discovery.client.queries.impl.QueryBox |
|---|
equals, hashCode, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT
| Constructor Detail |
|---|
public QueryTemplate(String template)
template - the template
public QueryTemplate(String template,
Map<String,String> parameters)
template - the template| Method Detail |
|---|
public String expression()
Query
expression in interface Queryexpression in class QueryBox
public void addParameter(String name,
String value)
name - the parameter namevalue - the parameter value
IllegalStateException - if the parameter name or value are null
public void appendParameter(String name,
String value)
name - the parameter namevalue - the value
IllegalStateException - if the parameter name or value are null
public String parameter(String name)
throws IllegalStateException
name - the parameter name
IllegalStateException - if the parameter does not exist
IllegalStateException - if the parameter name is nullpublic boolean hasParameter(String name)
true if the query has a given parameter.
name - the parameter name
true if the query has a given parameter, false otherwise
IllegalStateException - if the parameter name is null
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||