org.silverpeas.persistence.repository
Class QueryCriteria.Clause

java.lang.Object
  extended by org.silverpeas.persistence.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.


Constructor Summary
QueryCriteria.Clause(String criterionText, T parameters)
          Constructs a clause from the specified first criterion and with the specified parameters.
QueryCriteria.Clause(T parameters)
          Constructs a clause with the specified parameters.
 
Method Summary
 QueryCriteria.Clause add(String criterionText)
          Adds a criterion to this clause.
<T extends Parameters>
T
parameters()
          Gets the parameters refered by the clause.
 QueryCriteria.Clause replaceLast(String criterionText)
          Replaces the last criterion by the specified one.
 String text()
          Gets the text of the clause.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryCriteria.Clause

public QueryCriteria.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 the QueryCriteria implementation.
parameters - the parameters initialized by the caller and that will be used in this clause.

QueryCriteria.Clause

public QueryCriteria.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 the QueryCriteria 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 the QueryCriteria 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 refered by the clause.

Type Parameters:
T -
Returns:
all the parameters to apply with the clause to a query.


Copyright © 2016 Silverpeas. All Rights Reserved.