public abstract class AbstractPathImpl<X> extends ExpressionImpl<X> implements Path<X>, PathImplementor<X>, Serializable
Path
implementations.ParameterContainer.Helper
Constructor and Description |
---|
AbstractPathImpl(CriteriaBuilderImpl criteriaBuilder,
Class<X> javaType,
PathSource pathSource)
Constructs a basic path instance.
|
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
canBeDereferenced() |
<K,V,M extends Map<K,V>> |
get(MapAttribute<X,K,V> attribute)
Create a path corresponding to the referenced
map-valued attribute.
|
<E,C extends Collection<E>> |
get(PluralAttribute<X,C,E> attribute)
Create a path corresponding to the referenced
collection-valued attribute.
|
<Y> Path<Y> |
get(SingularAttribute<? super X,Y> attribute)
Create a path corresponding to the referenced
single-valued attribute.
|
<Y> Path<Y> |
get(String attributeName)
Create a path corresponding to the referenced attribute.
|
PathSource<?> |
getParentPath()
Return the parent "node" in the path or null if no parent.
|
String |
getPathIdentifier()
Get the string representation of this path as a navigation from one of the
queries identification variables
|
PathSource |
getPathSource() |
protected PathSource |
getPathSourceForSubPaths() |
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(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(RenderingContext renderingContext) |
String |
renderProjection(RenderingContext renderingContext) |
protected Path |
resolveCachedAttributePath(String attributeName) |
Expression<Class<? extends X>> |
type()
Create an expression corresponding to the type of the path.
|
protected RuntimeException |
unknownAttribute(String attributeName) |
as, asBigDecimal, asBigInteger, asDouble, asFloat, asInteger, asLong, asString, in, in, in, in, isNotNull, isNull
alias, getCompoundSelectionItems, getValueHandlers, isCompoundSelection
forceConversion, getAlias, getJavaType, getValueHandler, resetJavaType, setAlias
criteriaBuilder
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAttribute, treatAs
asBigDecimal, asBigInteger, asDouble, asFloat, asInteger, asLong, asString
getValueHandlers
getValueHandler
as, in, in, in, in, isNotNull, isNull
alias, getCompoundSelectionItems, isCompoundSelection
getAlias, getJavaType
public AbstractPathImpl(CriteriaBuilderImpl criteriaBuilder, Class<X> javaType, PathSource pathSource)
criteriaBuilder
- The criteria builderjavaType
- The java type of this pathpathSource
- The source (or origin) from which this path originatespublic PathSource getPathSource()
public PathSource<?> getParentPath()
Path
getParentPath
in interface Path<X>
public Expression<Class<? extends X>> type()
Path
public String getPathIdentifier()
PathSource
getPathIdentifier
in interface PathSource<X>
protected abstract boolean canBeDereferenced()
protected final RuntimeException illegalDereference()
protected final RuntimeException unknownAttribute(String attributeName)
public <Y> Path<Y> get(SingularAttribute<? super X,Y> attribute)
Path
protected PathSource getPathSourceForSubPaths()
public <E,C extends Collection<E>> Expression<C> get(PluralAttribute<X,C,E> attribute)
Path
public <K,V,M extends Map<K,V>> Expression<M> get(MapAttribute<X,K,V> attribute)
Path
public <Y> Path<Y> get(String attributeName)
Path
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));
protected final Attribute locateAttribute(String attributeName)
attributeName
- The name of the attribute to locateIllegalArgumentException
- If no such attribute existsprotected abstract Attribute locateAttributeInternal(String attributeName)
locateAttribute(java.lang.String)
which also applies nullness checking for proper error reporting.attributeName
- The name of the attribute to locateIllegalArgumentException
- If no such attribute existspublic void registerParameters(ParameterRegistry registry)
ParameterContainer
registerParameters
in interface ParameterContainer
registry
- The parameter registry with which to register.public void prepareAlias(RenderingContext renderingContext)
prepareAlias
in interface PathSource<X>
public String render(RenderingContext renderingContext)
render
in interface Renderable
public String renderProjection(RenderingContext renderingContext)
renderProjection
in interface Renderable
Copyright © 2016 JBoss by Red Hat. All rights reserved.