org.hibernate.ejb.criteria.expression
Class SimpleCaseExpression<C,R>

java.lang.Object
  extended by org.hibernate.ejb.criteria.AbstractNode
      extended by org.hibernate.ejb.criteria.expression.AbstractTupleElement<X>
          extended by org.hibernate.ejb.criteria.expression.SelectionImpl<T>
              extended by org.hibernate.ejb.criteria.expression.ExpressionImpl<R>
                  extended by org.hibernate.ejb.criteria.expression.SimpleCaseExpression<C,R>
All Implemented Interfaces:
Serializable, CriteriaBuilder.SimpleCase<C,R>, Expression<R>, Selection<R>, TupleElement<R>, ExpressionImplementor<R>, ParameterContainer, Renderable, SelectionImplementor<R>, TupleElementImplementor<R>

public class SimpleCaseExpression<C,R>
extends ExpressionImpl<R>
implements CriteriaBuilder.SimpleCase<C,R>, Serializable

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
 

See Also:
Serialized Form

Nested Class Summary
 class SimpleCaseExpression.WhenClause
           
 
Nested classes/interfaces inherited from interface org.hibernate.ejb.criteria.ParameterContainer
ParameterContainer.Helper
 
Constructor Summary
SimpleCaseExpression(CriteriaBuilderImpl criteriaBuilder, Class<R> javaType, Expression<? extends C> expression)
           
 
Method Summary
 Expression<C> getExpression()
           
 Expression<? extends R> getOtherwiseResult()
           
 List<SimpleCaseExpression.WhenClause> getWhenClauses()
           
 Expression<R> otherwise(Expression<? extends R> result)
           
 Expression<R> otherwise(R result)
           
 void registerParameters(ParameterRegistry registry)
          Register any parameters contained within this query component with the given registry.
 String render(CriteriaQueryCompiler.RenderingContext renderingContext)
           
 String renderProjection(CriteriaQueryCompiler.RenderingContext renderingContext)
           
 CriteriaBuilder.SimpleCase<C,R> when(C condition, Expression<? extends R> result)
           
 CriteriaBuilder.SimpleCase<C,R> when(C condition, R result)
           
 
Methods inherited from class org.hibernate.ejb.criteria.expression.ExpressionImpl
as, asBigDecimal, asBigInteger, asDouble, asFloat, asInteger, asLong, asString, in, in, in, in, isNotNull, isNull
 
Methods inherited from class org.hibernate.ejb.criteria.expression.SelectionImpl
alias, getCompoundSelectionItems, getValueHandlers, isCompoundSelection
 
Methods inherited from class org.hibernate.ejb.criteria.expression.AbstractTupleElement
forceConversion, getAlias, getJavaType, getValueHandler, resetJavaType, setAlias
 
Methods inherited from class org.hibernate.ejb.criteria.AbstractNode
criteriaBuilder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.persistence.criteria.Expression
as, in, in, in, in, isNotNull, isNull
 
Methods inherited from interface javax.persistence.criteria.Selection
alias, getCompoundSelectionItems, isCompoundSelection
 
Methods inherited from interface javax.persistence.TupleElement
getAlias, getJavaType
 
Methods inherited from interface org.hibernate.ejb.criteria.SelectionImplementor
getValueHandlers
 
Methods inherited from interface org.hibernate.ejb.criteria.TupleElementImplementor
getValueHandler
 

Constructor Detail

SimpleCaseExpression

public SimpleCaseExpression(CriteriaBuilderImpl criteriaBuilder,
                            Class<R> javaType,
                            Expression<? extends C> expression)
Method Detail

getExpression

public Expression<C> getExpression()
Specified by:
getExpression in interface CriteriaBuilder.SimpleCase<C,R>

when

public CriteriaBuilder.SimpleCase<C,R> when(C condition,
                                            R result)
Specified by:
when in interface CriteriaBuilder.SimpleCase<C,R>

when

public CriteriaBuilder.SimpleCase<C,R> when(C condition,
                                            Expression<? extends R> result)
Specified by:
when in interface CriteriaBuilder.SimpleCase<C,R>

otherwise

public Expression<R> otherwise(R result)
Specified by:
otherwise in interface CriteriaBuilder.SimpleCase<C,R>

otherwise

public Expression<R> otherwise(Expression<? extends R> result)
Specified by:
otherwise in interface CriteriaBuilder.SimpleCase<C,R>

getOtherwiseResult

public Expression<? extends R> getOtherwiseResult()

getWhenClauses

public List<SimpleCaseExpression.WhenClause> getWhenClauses()

registerParameters

public void registerParameters(ParameterRegistry registry)
Description copied from interface: ParameterContainer
Register any parameters contained within this query component with the given registry.

Specified by:
registerParameters in interface ParameterContainer
Parameters:
registry - The parameter registry with which to register.

render

public String render(CriteriaQueryCompiler.RenderingContext renderingContext)
Specified by:
render in interface Renderable

renderProjection

public String renderProjection(CriteriaQueryCompiler.RenderingContext renderingContext)
Specified by:
renderProjection in interface Renderable


Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.