Top Description Fields Constructors Methods
org.hibernate.query.criteria.internal.path

public abstract Class AbstractPathImpl<X>

extends ExpressionImpl<X>
implements Path<X>, PathImplementor<X>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.hibernate.query.criteria.internal.PathImplementor, org.hibernate.query.criteria.internal.Renderable, org.hibernate.query.criteria.internal.PathSource, javax.persistence.criteria.Path, javax.persistence.criteria.Expression, javax.persistence.criteria.Selection, javax.persistence.TupleElement, org.hibernate.query.criteria.internal.ExpressionImplementor, org.hibernate.query.criteria.internal.SelectionImplementor, org.hibernate.query.criteria.internal.TupleElementImplementor
Known Direct Subclasses
org.hibernate.query.criteria.internal.path.MapKeyHelpers.MapKeyPath, org.hibernate.query.criteria.internal.path.MapKeyHelpers.MapKeySource, org.hibernate.query.criteria.internal.path.PluralAttributePath, org.hibernate.query.criteria.internal.path.SingularAttributePath, org.hibernate.query.criteria.internal.path.AbstractFromImpl
Imports
java.io.Serializable, java.util.Collection, .HashMap, .Map, javax.persistence.criteria.Expression, .Path, javax.persistence.metamodel.Attribute, .MapAttribute, .PluralAttribute, .SingularAttribute, org.hibernate.query.criteria.internal.CriteriaBuilderImpl, .ParameterRegistry, .PathImplementor, .PathSource, org.hibernate.query.criteria.internal.compile.RenderingContext, org.hibernate.query.criteria.internal.expression.ExpressionImpl, .PathTypeExpression

Convenience base class for various Path implementations.
Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
private Map<String, Path<X>>
private final PathSource<X>
private final Expression<Class<? extends X>>

Constructor Summary

AccessConstructor and Description
public
AbstractPathImpl(CriteriaBuilderImpl
The criteria builder
criteriaBuilder
,
Class<X>
The java type of this path
javaType
,
PathSource<X>
The source (or origin) from which this path originates
pathSource
)

Constructs a basic path instance.

Method Summary

Modifier and TypeMethod and Description
protected abstract boolean
public <Y> Path<Y>
get(SingularAttribute<? super X, Y>
single-valued attribute
attribute
)

Implements javax.persistence.criteria.Path.get.

Create a path corresponding to the referenced single-valued attribute.
public <E, C extends Collection<E>> Expression<C>
get(PluralAttribute<X, C, E>
collection-valued attribute
attribute
)

Implements javax.persistence.criteria.Path.get.

Create a path corresponding to the referenced collection-valued attribute.
public <K, V, M extends Map<K, V>> Expression<M>
get(MapAttribute<X, K, V>
map-valued attribute
attribute
)

Implements javax.persistence.criteria.Path.get.

Create a path corresponding to the referenced map-valued attribute.
public <Y> Path<Y>
get(String
name of the attribute
attributeName
)

Implements javax.persistence.criteria.Path.get.

Create a path corresponding to the referenced attribute.
public PathSource<?>
getParentPath()

Implements javax.persistence.criteria.Path.getParentPath.

Return the parent "node" in the path or null if no parent.
public String
getPathIdentifier()

Implements org.hibernate.query.criteria.internal.PathSource.getPathIdentifier.

Get the string representation of this path as a navigation from one of the queries identification variables
public PathSource<X>
protected PathSource<X>
protected final RuntimeException
protected final Attribute<X, Y>

Returns:

The attribute; should never return null.
locateAttribute
(String
The name of the attribute to locate
attributeName
)

Get the attribute by name from the underlying model.

protected abstract Attribute<X, Y>

Returns:

The attribute; may be null.
locateAttributeInternal
(String
The name of the attribute to locate
attributeName
)

Get the attribute by name from the underlying model.

public void
protected final void
registerAttributePath(String attributeName, Path<X> path)

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
protected final Path<X>
public Expression<Class<? extends X>>
type()

Implements javax.persistence.criteria.Path.type.

Create an expression corresponding to the type of the path.
protected final RuntimeException
unknownAttribute(String attributeName)

Inherited from org.hibernate.query.criteria.internal.expression.ExpressionImpl:
asasBigDecimalasBigIntegerasDoubleasFloatasIntegerasLongasStringininininisNotNullisNull

Field Detail

attributePathRegistryback to summary
private Map<String, Path<X>> attributePathRegistry
pathSourceback to summary
private final PathSource<X> pathSource
typeExpressionback to summary
private final Expression<Class<? extends X>> typeExpression

Constructor Detail

AbstractPathImplback to summary
public AbstractPathImpl(CriteriaBuilderImpl criteriaBuilder, Class<X> javaType, PathSource<X> pathSource)

Constructs a basic path instance.

Parameters
criteriaBuilder:CriteriaBuilderImpl

The criteria builder

javaType:Class<X>

The java type of this path

pathSource:PathSource<X>

The source (or origin) from which this path originates

Annotations
@SuppressWarnings:unchecked

Method Detail

canBeDereferencedback to summary
protected abstract boolean canBeDereferenced()
getback to summary
public <Y> Path<Y> get(SingularAttribute<? super X, Y> attribute)

Implements javax.persistence.criteria.Path.get.

Doc from javax.persistence.criteria.Path.get.

Create a path corresponding to the referenced single-valued attribute.

Parameters
attribute:SingularAttribute<? super X, Y>

single-valued attribute

Returns:Path<Y>

path corresponding to the referenced attribute

Annotations
@Override
@SuppressWarnings:unchecked
getback to summary
public <E, C extends Collection<E>> Expression<C> get(PluralAttribute<X, C, E> attribute)

Implements javax.persistence.criteria.Path.get.

Doc from javax.persistence.criteria.Path.get.

Create a path corresponding to the referenced collection-valued attribute.

Parameters
attribute:PluralAttribute<X, C, E>

collection-valued attribute

Returns:Expression<C>

expression corresponding to the referenced attribute

Annotations
@Override
@SuppressWarnings:unchecked
getback to summary
public <K, V, M extends Map<K, V>> Expression<M> get(MapAttribute<X, K, V> attribute)

Implements javax.persistence.criteria.Path.get.

Doc from javax.persistence.criteria.Path.get.

Create a path corresponding to the referenced map-valued attribute.

Parameters
attribute:MapAttribute<X, K, V>

map-valued attribute

Returns:Expression<M>

expression corresponding to the referenced attribute

Annotations
@Override
@SuppressWarnings:unchecked
getback to summary
public <Y> Path<Y> get(String attributeName)

Implements javax.persistence.criteria.Path.get.

Doc from javax.persistence.criteria.Path.get.

Create a path corresponding to the referenced attribute.

Note

Applications using the string-based API may need to specify the type resulting from the get operation in order to avoid the use of Path variables.

   For example:

   CriteriaQuery<Person> q = cb.createQuery(Person.class);
   Root<Person> p = q.from(Person.class);
   q.select(p)
    .where(cb.isMember("joe",
                       p.<Set<String>>get("nicknames")));

   rather than:

   CriteriaQuery<Person> q = cb.createQuery(Person.class);
   Root<Person> p = q.from(Person.class);
   Path<Set<String>> nicknames = p.get("nicknames");
   q.select(p)
    .where(cb.isMember("joe", nicknames));
Parameters
attributeName:String

name of the attribute

Returns:Path<Y>

path corresponding to the referenced attribute

Annotations
@Override
@SuppressWarnings:unchecked
getParentPathback to summary
public PathSource<?> getParentPath()

Implements javax.persistence.criteria.Path.getParentPath.

Doc from javax.persistence.criteria.Path.getParentPath.

Return the parent "node" in the path or null if no parent.

Returns:PathSource<?>

parent

Annotations
@Override
getPathIdentifierback to summary
public String getPathIdentifier()

Implements org.hibernate.query.criteria.internal.PathSource.getPathIdentifier.

Doc from org.hibernate.query.criteria.internal.PathSource.getPathIdentifier.

Get the string representation of this path as a navigation from one of the queries identification variables

Returns:String

The path's identifier.

Annotations
@Override
getPathSourceback to summary
public PathSource<X> getPathSource()
getPathSourceForSubPathsback to summary
protected PathSource<X> getPathSourceForSubPaths()
illegalDereferenceback to summary
protected final RuntimeException illegalDereference()
locateAttributeback to summary
protected final Attribute<X, Y> 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:String

The name of the attribute to locate

Returns:Attribute<X, Y>

The attribute; should never return null.

Exceptions
IllegalArgumentException:
If no such attribute exists
locateAttributeInternalback to summary
protected abstract Attribute<X, Y> 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 which also applies nullness checking for proper error reporting.

Parameters
attributeName:String

The name of the attribute to locate

Returns:Attribute<X, Y>

The attribute; may be null.

Exceptions
IllegalArgumentException:
If no such attribute exists
prepareAliasback to summary
public void prepareAlias(RenderingContext renderingContext)

Implements org.hibernate.query.criteria.internal.PathSource.prepareAlias.

Annotations
@Override
registerAttributePathback to summary
protected final void registerAttributePath(String attributeName, Path<X> path)
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.

Annotations
@Override
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
resolveCachedAttributePathback to summary
protected final Path<X> resolveCachedAttributePath(String attributeName)
typeback to summary
public Expression<Class<? extends X>> type()

Implements javax.persistence.criteria.Path.type.

Doc from javax.persistence.criteria.Path.type.

Create an expression corresponding to the type of the path.

Returns:Expression<Class<? extends X>>

expression corresponding to the type of the path

Annotations
@Override
@SuppressWarnings:unchecked
unknownAttributeback to summary
protected final RuntimeException unknownAttribute(String attributeName)