sk.baka.tools.jpa
Class CriteriaList.Criteria

java.lang.Object
  extended by sk.baka.tools.jpa.CriteriaList.Criteria
All Implemented Interfaces:
Serializable
Enclosing class:
CriteriaList

@Immutable
public static class CriteriaList.Criteria
extends Object
implements Serializable

Holds a single criteria.

See Also:
Serialized Form

Field Summary
 Serializable desiredValue
          the desired value.
 String jpaField
          The JPA field to match (or a valid JPA expression)
 OperatorEnum operator
          The operator to use.
 
Constructor Summary
CriteriaList.Criteria(String jpaField, OperatorEnum op, Serializable desiredValue)
          Creates a new criteria object.
 
Method Summary
 boolean equals(Object obj)
           
 CriteriaList.Criteria getWithPrefix(String prefix)
          Prefixes the JPA field expression with given prefix and returns a new Criteria object.
 int hashCode()
           
 String toJpaQueryCondition(List<Object> parameters)
          Converts this criteria to a JPA WHERE condition.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

desiredValue

public final Serializable desiredValue
the desired value.


operator

public final OperatorEnum operator
The operator to use.


jpaField

public final String jpaField
The JPA field to match (or a valid JPA expression)

Constructor Detail

CriteriaList.Criteria

public CriteriaList.Criteria(String jpaField,
                             OperatorEnum op,
                             Serializable desiredValue)
Creates a new criteria object.

Parameters:
jpaField - the JPA field name or an expression.
desiredValue - the desired value.
op - the operator to use.
Method Detail

toJpaQueryCondition

public String toJpaQueryCondition(List<Object> parameters)
Converts this criteria to a JPA WHERE condition.

Parameters:
parameters - current list of parameters. The query parameters are added to this list by the method.
Returns:
a condition (wrapped in parenthesis)

getWithPrefix

public CriteriaList.Criteria getWithPrefix(String prefix)
Prefixes the JPA field expression with given prefix and returns a new Criteria object.

Parameters:
prefix - the prefix to use
Returns:
new criteria with prefixed JPA column.

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2009-2010. All Rights Reserved.