Class QueryCriteria.Clause
- java.lang.Object
-
- org.silverpeas.core.persistence.datasource.repository.QueryCriteria.Clause
-
- Enclosing interface:
- QueryCriteria
public static class QueryCriteria.Clause extends Object
A clause representing the criteria the entities have to match. The parameters used in this clause are initialized by the caller and passed as such to the clause. By letting the caller the charge of managing the parameters, they can be used accross several clauses and in different process implied in the final query build.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description QueryCriteria.Clause
add(String criterionText)
Adds a criterion to this clause.<T extends Parameters>
Tparameters()
Gets the parameters referred by the clause.QueryCriteria.Clause
replaceLast(String criterionText)
Replaces the last criterion by the specified one.String
text()
Gets the text of the clause.
-
-
-
Constructor Detail
-
Clause
public Clause(String criterionText, T parameters)
Constructs a clause from the specified first criterion and with the specified parameters.- Type Parameters:
T
- the concrete type of the parameters to use in this clause.- Parameters:
criterionText
- a text representation of the criterion to add. The text representatipn is in charge to theQueryCriteria
implementation.parameters
- the parameters initialized by the caller and that will be used in this clause.
-
Clause
public Clause(T parameters)
Constructs a clause with the specified parameters.- Type Parameters:
T
- the concrete type of the parameters to use in this clause.- Parameters:
parameters
- the parameters initialized by the caller and that will be used in this clause.
-
-
Method Detail
-
add
public QueryCriteria.Clause add(String criterionText)
Adds a criterion to this clause.- Parameters:
criterionText
- a text representation of the criterion to add. The text representation is in charge to theQueryCriteria
implementation. If the text is null or empty, then nothing is added.- Returns:
- itself enriched with the new criterion.
-
replaceLast
public QueryCriteria.Clause replaceLast(String criterionText)
Replaces the last criterion by the specified one.- Parameters:
criterionText
- a text representation of the criterion to add. The text representatipn is in charge to theQueryCriteria
implementation.- Returns:
- itself with the new criterion replacing the last one.
-
text
public String text()
Gets the text of the clause. Each criterion in the clause is separated by a space.- Returns:
- a text representation of the clause.
-
parameters
public <T extends Parameters> T parameters()
Gets the parameters referred by the clause.- Type Parameters:
T
- the concrete type of the parameters.- Returns:
- all the parameters to apply with the clause to a query.
-
-