Top Description Inners Fields Constructors Methods
org.hibernate.query.criteria.internal.expression

public Class SimpleCaseExpression<C, R>

extends ExpressionImpl<R>
implements CriteriaBuilder.SimpleCase<C, R>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, javax.persistence.criteria.CriteriaBuilder.SimpleCase, javax.persistence.criteria.Expression, javax.persistence.criteria.Selection, javax.persistence.TupleElement
Imports
java.io.Serializable, java.util.ArrayList, .List, javax.persistence.criteria.CriteriaBuilder.SimpleCase, .Expression, org.hibernate.query.criteria.internal.CriteriaBuilderImpl, .ParameterRegistry, .Renderable, org.hibernate.query.criteria.internal.compile.RenderingContext

Models what ANSI SQL terms a simple case statement. This is a CASE expression in the form
CASE [expression]
    WHEN [firstCondition] THEN [firstResult]
    WHEN [secondCondition] THEN [secondResult]
    ELSE [defaultResult]
END
Author
Steve Ebersole

Nested and Inner Type Summary

Modifier and TypeClass and Description
public class

Field Summary

Modifier and TypeField and Description
private final Expression<? extends C>
private Expression<? extends R>
private List<SimpleCaseExpression<C, R>.WhenClause>

Constructor Summary

AccessConstructor and Description
public
SimpleCaseExpression(CriteriaBuilderImpl criteriaBuilder, Class<R> javaType, Expression<? extends C> expression)

Method Summary

Modifier and TypeMethod and Description
private LiteralExpression<R>
buildLiteral(R result)

public Expression<C>
getExpression()

Implements javax.persistence.criteria.CriteriaBuilder.SimpleCase.getExpression.

Return the expression to be tested against the conditions.
public Expression<? extends R>
public List<SimpleCaseExpression<C, R>.WhenClause>
public Expression<R>
otherwise(R
"else" result
result
)

Implements javax.persistence.criteria.CriteriaBuilder.SimpleCase.otherwise.

Add an "else" clause to the case expression.
public Expression<R>
otherwise(Expression<? extends R>
"else" result expression
result
)

Implements javax.persistence.criteria.CriteriaBuilder.SimpleCase.otherwise, javax.persistence.criteria.CriteriaBuilder.SimpleCase.otherwise.

Add an "else" clause to the case expression.
public void
registerParameters(ParameterRegistry
The parameter registry with which to register.
registry
)

Implements org.hibernate.query.criteria.internal.ParameterContainer.registerParameters.

Register any parameters contained within this query component with the given registry.
public String
render(RenderingContext renderingContext)

Implements org.hibernate.query.criteria.internal.Renderable.render.

Perform the rendering, returning the rendition
public CriteriaBuilder.SimpleCase<C, R>
when(C
"when" condition
condition
,
R
"then" result value
result
)

Implements javax.persistence.criteria.CriteriaBuilder.SimpleCase.when.

Add a when/then clause to the case expression.
public CriteriaBuilder.SimpleCase<C, R>
when(C
"when" condition
condition
,
Expression<? extends R>
"then" result expression
result
)

Implements javax.persistence.criteria.CriteriaBuilder.SimpleCase.when, javax.persistence.criteria.CriteriaBuilder.SimpleCase.when.

Add a when/then clause to the case expression.
Inherited from org.hibernate.query.criteria.internal.expression.ExpressionImpl:
asasBigDecimalasBigIntegerasDoubleasFloatasIntegerasLongasStringininininisNotNullisNull

Field Detail

expressionback to summary
private final Expression<? extends C> expression
otherwiseResultback to summary
private Expression<? extends R> otherwiseResult
whenClausesback to summary
private List<SimpleCaseExpression<C, R>.WhenClause> whenClauses

Constructor Detail

SimpleCaseExpressionback to summary
public SimpleCaseExpression(CriteriaBuilderImpl criteriaBuilder, Class<R> javaType, Expression<? extends C> expression)

Method Detail

buildLiteralback to summary
private LiteralExpression<R> buildLiteral(R result)
Annotations
@SuppressWarnings:unchecked
getExpressionback to summary
public Expression<C> getExpression()

Implements javax.persistence.criteria.CriteriaBuilder.SimpleCase.getExpression.

Doc from javax.persistence.criteria.CriteriaBuilder.SimpleCase.getExpression.

Return the expression to be tested against the conditions.

Returns:Expression<C>

expression

Annotations
@SuppressWarnings:unchecked
getOtherwiseResultback to summary
public Expression<? extends R> getOtherwiseResult()
getWhenClausesback to summary
public List<SimpleCaseExpression<C, R>.WhenClause> getWhenClauses()
otherwiseback to summary
public Expression<R> otherwise(R result)

Implements javax.persistence.criteria.CriteriaBuilder.SimpleCase.otherwise.

Doc from javax.persistence.criteria.CriteriaBuilder.SimpleCase.otherwise.

Add an "else" clause to the case expression.

Parameters
result:R

"else" result

Returns:Expression<R>

expression

otherwiseback to summary
public Expression<R> otherwise(Expression<? extends R> result)

Implements javax.persistence.criteria.CriteriaBuilder.SimpleCase.otherwise, javax.persistence.criteria.CriteriaBuilder.SimpleCase.otherwise.

Doc from javax.persistence.criteria.CriteriaBuilder.SimpleCase.otherwise.

Add an "else" clause to the case expression.

Parameters
result:Expression<? extends R>

"else" result expression

Returns:Expression<R>

expression

registerParametersback to summary
public void registerParameters(ParameterRegistry registry)

Implements org.hibernate.query.criteria.internal.ParameterContainer.registerParameters.

Doc from org.hibernate.query.criteria.internal.ParameterContainer.registerParameters.

Register any parameters contained within this query component with the given registry.

Parameters
registry:ParameterRegistry

The parameter registry with which to register.

renderback to summary
public String render(RenderingContext renderingContext)

Implements org.hibernate.query.criteria.internal.Renderable.render.

Doc from org.hibernate.query.criteria.internal.Renderable.render.

Perform the rendering, returning the rendition

Annotations
@Override
whenback to summary
public CriteriaBuilder.SimpleCase<C, R> when(C condition, R result)

Implements javax.persistence.criteria.CriteriaBuilder.SimpleCase.when.

Doc from javax.persistence.criteria.CriteriaBuilder.SimpleCase.when.

Add a when/then clause to the case expression.

Parameters
condition:C

"when" condition

result:R

"then" result value

Returns:CriteriaBuilder.SimpleCase<C, R>

simple case expression

whenback to summary
public CriteriaBuilder.SimpleCase<C, R> when(C condition, Expression<? extends R> result)

Implements javax.persistence.criteria.CriteriaBuilder.SimpleCase.when, javax.persistence.criteria.CriteriaBuilder.SimpleCase.when.

Doc from javax.persistence.criteria.CriteriaBuilder.SimpleCase.when.

Add a when/then clause to the case expression.

Parameters
condition:C

"when" condition

result:Expression<? extends R>

"then" result expression

Returns:CriteriaBuilder.SimpleCase<C, R>

simple case expression

org.hibernate.query.criteria.internal.expression back to summary

public Class SimpleCaseExpression.WhenClause

extends Object
Class Inheritance
  • java.lang.Object
  • org.hibernate.query.criteria.internal.expression.SimpleCaseExpression.WhenClause

Field Summary

Modifier and TypeField and Description
private final LiteralExpression<C>
private final Expression<? extends R>

Constructor Summary

AccessConstructor and Description
public
WhenClause(LiteralExpression<C> condition, Expression<? extends R> result)

Method Summary

Modifier and TypeMethod and Description
public LiteralExpression<C>
public Expression<? extends R>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

conditionback to summary
private final LiteralExpression<C> condition
resultback to summary
private final Expression<? extends R> result

Constructor Detail

WhenClauseback to summary
public WhenClause(LiteralExpression<C> condition, Expression<? extends R> result)

Method Detail

getConditionback to summary
public LiteralExpression<C> getCondition()
getResultback to summary
public Expression<? extends R> getResult()