org.hibernate.ejb.criteria.path
Class AbstractPathImpl<X>

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<X>
                  extended by org.hibernate.ejb.criteria.path.AbstractPathImpl<X>
All Implemented Interfaces:
Serializable, Expression<X>, Path<X>, Selection<X>, TupleElement<X>, ExpressionImplementor<X>, ParameterContainer, PathImplementor<X>, PathSource<X>, Renderable, SelectionImplementor<X>, TupleElementImplementor<X>
Direct Known Subclasses:
AbstractFromImpl, MapKeyHelpers.MapKeyPath, MapKeyHelpers.MapKeySource, PluralAttributePath, SingularAttributePath

public abstract class AbstractPathImpl<X>
extends ExpressionImpl<X>
implements Path<X>, PathImplementor<X>, Serializable

Convenience base class for various Path implementors.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.hibernate.ejb.criteria.ParameterContainer
ParameterContainer.Helper
 
Constructor Summary
AbstractPathImpl(CriteriaBuilderImpl criteriaBuilder, Class<X> javaType, PathSource pathSource)
          Constructs a basic path instance.
 
Method Summary
protected abstract  boolean canBeDereferenced()
           
<K,V,M extends Map<K,V>>
Expression<M>
get(MapAttribute<X,K,V> attribute)
          
<E,C extends Collection<E>>
Expression<C>
get(PluralAttribute<X,C,E> attribute)
          
<Y> Path<Y>
get(SingularAttribute<? super X,Y> attribute)
          
<Y> Path<Y>
get(String attributeName)
          
 PathSource<?> getParentPath()
          
 String getPathIdentifier()
          Get the string representation of this path as a navigation from one of the queries identification variables
 PathSource getPathSource()
           
protected  RuntimeException illegalDereference()
           
protected  Attribute locateAttribute(String attributeName)
          Get the attribute by name from the underlying model.
protected abstract  Attribute locateAttributeInternal(String attributeName)
          Get the attribute by name from the underlying model.
 void prepareAlias(CriteriaQueryCompiler.RenderingContext renderingContext)
           
protected  void registerAttributePath(String attributeName, Path path)
           
 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)
          
protected  Path resolveCachedAttributePath(String attributeName)
           
 Expression<Class<? extends X>> type()
          
protected  RuntimeException unknownAttribute(String attributeName)
           
 
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 org.hibernate.ejb.criteria.PathImplementor
getAttribute
 
Methods inherited from interface org.hibernate.ejb.criteria.ExpressionImplementor
asBigDecimal, asBigInteger, asDouble, asFloat, asInteger, asLong, asString
 
Methods inherited from interface org.hibernate.ejb.criteria.SelectionImplementor
getValueHandlers
 
Methods inherited from interface org.hibernate.ejb.criteria.TupleElementImplementor
getValueHandler
 
Methods inherited from interface javax.persistence.criteria.Path
getModel
 
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
 

Constructor Detail

AbstractPathImpl

public AbstractPathImpl(CriteriaBuilderImpl criteriaBuilder,
                        Class<X> javaType,
                        PathSource pathSource)
Constructs a basic path instance.

Parameters:
criteriaBuilder - The criteria builder
javaType - The java type of this path
pathSource - The source (or origin) from which this path originates
Method Detail

getPathSource

public PathSource getPathSource()

getParentPath

public PathSource<?> getParentPath()

Specified by:
getParentPath in interface Path<X>

type

public Expression<Class<? extends X>> type()

Specified by:
type in interface Path<X>

getPathIdentifier

public String getPathIdentifier()
Get the string representation of this path as a navigation from one of the queries identification variables

Specified by:
getPathIdentifier in interface PathSource<X>
Returns:
The path's identifier.

canBeDereferenced

protected abstract boolean canBeDereferenced()

illegalDereference

protected final RuntimeException illegalDereference()

unknownAttribute

protected final RuntimeException unknownAttribute(String attributeName)

resolveCachedAttributePath

protected final Path resolveCachedAttributePath(String attributeName)

registerAttributePath

protected final void registerAttributePath(String attributeName,
                                           Path path)

get

public <Y> Path<Y> get(SingularAttribute<? super X,Y> attribute)

Specified by:
get in interface Path<X>

get

public <E,C extends Collection<E>> Expression<C> get(PluralAttribute<X,C,E> attribute)

Specified by:
get in interface Path<X>

get

public <K,V,M extends Map<K,V>> Expression<M> get(MapAttribute<X,K,V> attribute)

Specified by:
get in interface Path<X>

get

public <Y> Path<Y> get(String attributeName)

Specified by:
get in interface Path<X>

locateAttribute

protected final Attribute locateAttribute(String attributeName)
Get the attribute by name from the underlying model. This allows subclasses to define exactly how the attribute is derived.

Parameters:
attributeName - The name of the attribute to locate
Returns:
The attribute; should never return null.
Throws:
IllegalArgumentException - If no such attribute exists

locateAttributeInternal

protected abstract Attribute locateAttributeInternal(String attributeName)
Get the attribute by name from the underlying model. This allows subclasses to define exactly how the attribute is derived. Called from locateAttribute(java.lang.String) which also applies nullness checking for proper error reporting.

Parameters:
attributeName - The name of the attribute to locate
Returns:
The attribute; may be null.
Throws:
IllegalArgumentException - If no such attribute exists

registerParameters

public void registerParameters(ParameterRegistry registry)
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.

prepareAlias

public void prepareAlias(CriteriaQueryCompiler.RenderingContext renderingContext)
Specified by:
prepareAlias in interface PathSource<X>

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-2015 Red Hat, Inc. All Rights Reserved.