org.apache.openjpa.persistence.query
Class CaseExpressionImpl

java.lang.Object
  extended by org.apache.openjpa.persistence.query.CaseExpressionImpl
All Implemented Interfaces:
Serializable, CaseExpression, Visitable

public class CaseExpressionImpl
extends Object
implements CaseExpression, Visitable

See Also:
Serialized Form

Constructor Summary
CaseExpressionImpl()
           
CaseExpressionImpl(Object caseOperand)
           
 
Method Summary
 String asExpression(AliasContext ctx)
          Get a JPQL fragment as used in WHERE clause.
 String asJoinable(AliasContext ctx)
          Gets the string representation in FROM clause.
 String asProjection(AliasContext ctx)
          Gets the string representation in SELECT projection.
(package private)  void assertThenState()
           
(package private)  void assertWhenState()
           
 Expression elseCase(Calendar arg)
          Add else to a case expression.
 Expression elseCase(Class arg)
          Add else to a case expression.
 Expression elseCase(Date arg)
          Add else to a case expression.
 Expression elseCase(Enum<?> arg)
          Add else to a case expression.
 Expression elseCase(Expression arg)
          Add else to a case expression.
 Expression elseCase(Number arg)
          Add else to a case expression.
 Expression elseCase(String arg)
          Add else to a case expression.
 String getAliasHint(AliasContext ctx)
          Gets the hint to be used while creating alias.
 CaseExpression then(Calendar then)
          Add a then clause to a general or simple case expression.
 CaseExpression then(Class then)
          Add a then clause to a general or simple case expression.
 CaseExpression then(Date then)
          Add a then clause to a general or simple case expression.
 CaseExpression then(Enum<?> then)
          Add a then clause to a general or simple case expression.
 CaseExpression then(Expression then)
          Add a then clause to a general or simple case expression.
 CaseExpression then(Number then)
          Add a then clause to a general or simple case expression.
 CaseExpression then(String then)
          Add a then clause to a general or simple case expression.
(package private)  String toJPQL(AliasContext ctx, Object o)
           
 CaseExpression when(Calendar when)
          Add a when clause to a simple case expression.
 CaseExpression when(Class when)
          Add a when clause to a simple case expression.
 CaseExpression when(Date when)
          Add a when clause to a simple case expression.
 CaseExpression when(Enum<?> when)
          Add a when clause to a simple case expression.
 CaseExpression when(Expression when)
          Add a when clause to a simple case expression.
 CaseExpression when(Number when)
          Add a when clause to a simple case expression.
 CaseExpression when(Predicate when)
          Add a when predicate clause to a general case expression.
 CaseExpression when(String when)
          Add a when clause to a simple case expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CaseExpressionImpl

public CaseExpressionImpl()

CaseExpressionImpl

public CaseExpressionImpl(Object caseOperand)
Method Detail

elseCase

public Expression elseCase(Expression arg)
Description copied from interface: CaseExpression
Add else to a case expression. A case expression must have an else clause.

Specified by:
elseCase in interface CaseExpression
Parameters:
arg - - corresponds to the result of the case expression if the when condition is not satisfied
Returns:
Expression corresponding to the case expression with the added clause

elseCase

public Expression elseCase(String arg)
Description copied from interface: CaseExpression
Add else to a case expression. A case expression must have an else clause.

Specified by:
elseCase in interface CaseExpression
Parameters:
arg - - corresponds to the result of the case expression if the when condition is not satisfied
Returns:
Expression corresponding to the case expression with the added clause

elseCase

public Expression elseCase(Number arg)
Description copied from interface: CaseExpression
Add else to a case expression. A case expression must have an else clause.

Specified by:
elseCase in interface CaseExpression
Parameters:
arg - - corresponds to the result of the case expression if the when condition is not satisfied
Returns:
Expression corresponding to the case expression with the added clause

elseCase

public Expression elseCase(Date arg)
Description copied from interface: CaseExpression
Add else to a case expression. A case expression must have an else clause.

Specified by:
elseCase in interface CaseExpression
Parameters:
arg - - corresponds to the result of the case expression if the when condition is not satisfied
Returns:
Expression corresponding to the case expression with the added clause

elseCase

public Expression elseCase(Calendar arg)
Description copied from interface: CaseExpression
Add else to a case expression. A case expression must have an else clause.

Specified by:
elseCase in interface CaseExpression
Parameters:
arg - - corresponds to the result of the case expression if the when condition is not satisfied
Returns:
Expression corresponding to the case expression with the added clause

elseCase

public Expression elseCase(Class arg)
Description copied from interface: CaseExpression
Add else to a case expression. A case expression must have an else clause.

Specified by:
elseCase in interface CaseExpression
Parameters:
arg - - corresponds to the result of the case expression if the when condition is not satisfied
Returns:
Expression corresponding to the case expression with the added clause

elseCase

public Expression elseCase(Enum<?> arg)
Description copied from interface: CaseExpression
Add else to a case expression. A case expression must have an else clause.

Specified by:
elseCase in interface CaseExpression
Parameters:
arg - - corresponds to the result of the case expression if the when condition is not satisfied
Returns:
Expression corresponding to the case expression with the added clause

then

public CaseExpression then(Expression then)
Description copied from interface: CaseExpression
Add a then clause to a general or simple case expression. The then clause specifies the result corresponding to the immediately preceding when. Clauses are evaluated in the order added.

Specified by:
then in interface CaseExpression
Parameters:
then - - corresponds to the result of the case expression if the when is satisfied
Returns:
CaseExpression corresponding to the case with the added then clause

then

public CaseExpression then(Number then)
Description copied from interface: CaseExpression
Add a then clause to a general or simple case expression. The then clause specifies the result corresponding to the immediately preceding when. Clauses are evaluated in the order added.

Specified by:
then in interface CaseExpression
Parameters:
then - - corresponds to the result of the case expression if the when is satisfied
Returns:
CaseExpression corresponding to the case with the added then clause

then

public CaseExpression then(String then)
Description copied from interface: CaseExpression
Add a then clause to a general or simple case expression. The then clause specifies the result corresponding to the immediately preceding when. Clauses are evaluated in the order added.

Specified by:
then in interface CaseExpression
Parameters:
then - - corresponds to the result of the case expression if the when is satisfied
Returns:
CaseExpression corresponding to the case with the added then clause

then

public CaseExpression then(Date then)
Description copied from interface: CaseExpression
Add a then clause to a general or simple case expression. The then clause specifies the result corresponding to the immediately preceding when. Clauses are evaluated in the order added.

Specified by:
then in interface CaseExpression
Parameters:
then - - corresponds to the result of the case expression if the when is satisfied
Returns:
CaseExpression corresponding to the case with the added then clause

then

public CaseExpression then(Calendar then)
Description copied from interface: CaseExpression
Add a then clause to a general or simple case expression. The then clause specifies the result corresponding to the immediately preceding when. Clauses are evaluated in the order added.

Specified by:
then in interface CaseExpression
Parameters:
then - - corresponds to the result of the case expression if the when is satisfied
Returns:
CaseExpression corresponding to the case with the added then clause

then

public CaseExpression then(Class then)
Description copied from interface: CaseExpression
Add a then clause to a general or simple case expression. The then clause specifies the result corresponding to the immediately preceding when. Clauses are evaluated in the order added.

Specified by:
then in interface CaseExpression
Parameters:
then - - corresponds to the result of the case expression if the when is satisfied
Returns:
CaseExpression corresponding to the case with the added then clause

then

public CaseExpression then(Enum<?> then)
Description copied from interface: CaseExpression
Add a then clause to a general or simple case expression. The then clause specifies the result corresponding to the immediately preceding when. Clauses are evaluated in the order added.

Specified by:
then in interface CaseExpression
Parameters:
then - - corresponds to the result of the case expression if the when is satisfied
Returns:
CaseExpression corresponding to the case with the added then clause

when

public CaseExpression when(Predicate when)
Description copied from interface: CaseExpression
Add a when predicate clause to a general case expression. The when predicate must be followed by the corresponding then case expression that specifies the result of the specific case. Clauses are evaluated in the order added.

Specified by:
when in interface CaseExpression
Parameters:
when - - corresponds to the evaluation condition for the specific case
Returns:
CaseExpression corresponding to the case with the added when clause

when

public CaseExpression when(Expression when)
Description copied from interface: CaseExpression
Add a when clause to a simple case expression. The when case expression must be followed by the corresponding then case expression that specifies the result of the specific case. Clauses are evaluated in the order added

Specified by:
when in interface CaseExpression
Parameters:
when - - corresponds to the value against which the case operand of the simple case is tested
Returns:
CaseExpression corresponding to the case with the added clause

when

public CaseExpression when(Number when)
Description copied from interface: CaseExpression
Add a when clause to a simple case expression. The when case expression must be followed by the corresponding then case expression that specifies the result of the specific case. Clauses are evaluated in the order added

Specified by:
when in interface CaseExpression
Parameters:
when - - corresponds to the value against which the case operand of the simple case is tested
Returns:
CaseExpression corresponding to the case with the added clause

when

public CaseExpression when(String when)
Description copied from interface: CaseExpression
Add a when clause to a simple case expression. The when case expression must be followed by the corresponding then case expression that specifies the result of the specific case. Clauses are evaluated in the order added

Specified by:
when in interface CaseExpression
Parameters:
when - - corresponds to the value against which the case operand of the simple case is tested
Returns:
CaseExpression corresponding to the case with the added clause

when

public CaseExpression when(Date when)
Description copied from interface: CaseExpression
Add a when clause to a simple case expression. The when case expression must be followed by the corresponding then case expression that specifies the result of the specific case. Clauses are evaluated in the order added

Specified by:
when in interface CaseExpression
Parameters:
when - - corresponds to the value against which the case operand of the simple case is tested
Returns:
CaseExpression corresponding to the case with the added clause

when

public CaseExpression when(Calendar when)
Description copied from interface: CaseExpression
Add a when clause to a simple case expression. The when case expression must be followed by the corresponding then case expression that specifies the result of the specific case. Clauses are evaluated in the order added

Specified by:
when in interface CaseExpression
Parameters:
when - - corresponds to the value against which the case operand of the simple case is tested
Returns:
CaseExpression corresponding to the case with the added clause

when

public CaseExpression when(Class when)
Description copied from interface: CaseExpression
Add a when clause to a simple case expression. The when case expression must be followed by the corresponding then case expression that specifies the result of the specific case. Clauses are evaluated in the order added

Specified by:
when in interface CaseExpression
Parameters:
when - - corresponds to the value against which the case operand of the simple case is tested
Returns:
CaseExpression corresponding to the case with the added clause

when

public CaseExpression when(Enum<?> when)
Description copied from interface: CaseExpression
Add a when clause to a simple case expression. The when case expression must be followed by the corresponding then case expression that specifies the result of the specific case. Clauses are evaluated in the order added

Specified by:
when in interface CaseExpression
Parameters:
when - - corresponds to the value against which the case operand of the simple case is tested
Returns:
CaseExpression corresponding to the case with the added clause

assertWhenState

void assertWhenState()

assertThenState

void assertThenState()

asExpression

public String asExpression(AliasContext ctx)
Description copied from interface: Visitable
Get a JPQL fragment as used in WHERE clause.

Specified by:
asExpression in interface Visitable

asProjection

public String asProjection(AliasContext ctx)
Description copied from interface: Visitable
Gets the string representation in SELECT projection.

Specified by:
asProjection in interface Visitable

asJoinable

public String asJoinable(AliasContext ctx)
Description copied from interface: Visitable
Gets the string representation in FROM clause.

Specified by:
asJoinable in interface Visitable

getAliasHint

public String getAliasHint(AliasContext ctx)
Description copied from interface: Visitable
Gets the hint to be used while creating alias.

Specified by:
getAliasHint in interface Visitable

toJPQL

String toJPQL(AliasContext ctx,
              Object o)


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.