Interface Path<X>
- Type Parameters:
X- the type referenced by the path
- All Superinterfaces:
Expression<X>, Selection<X>, TupleElement<X>
- All Known Subinterfaces:
BooleanPath, CollectionJoin<Z,E>, From<Z, X>, Join<Z, X>, ListJoin<Z, E>, MapJoin<Z, K, V>, PluralJoin<Z, C, E>, Root<X>, SetJoin<Z, E>
Represents a simple or compound attribute path from a
bound type or collection, and is a "primitive" expression.
- Since:
- 2.0
-
Method Summary
Modifier and TypeMethodDescriptionget(BooleanAttribute<? super X> attribute) Create a path corresponding to the referenced single-valued attribute.<C extends Comparable<? super C>>
ComparableExpression<C> get(ComparableAttribute<? super X, C> attribute) Create a path corresponding to the referenced single-valued attribute.<K, V, M extends Map<K,V>>
PluralExpression<M, V> get(MapAttribute<? super X, K, V> map) Create a path corresponding to the referenced map-valued attribute.<N extends Number & Comparable<N>>
NumericExpression<N> get(NumericAttribute<? super X, N> attribute) Create a path corresponding to the referenced single-valued attribute.<E, C extends Collection<E>>
PluralExpression<C, E> get(PluralAttribute<? super X, C, E> collection) 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.<T extends Temporal & Comparable<? super T>>
TemporalExpression<T> get(TemporalAttribute<? super X, T> attribute) Create a path corresponding to the referenced single-valued attribute.get(TextAttribute<? super X> attribute) Create a path corresponding to the referenced single-valued attribute.<Y> Path<Y> Create a path corresponding to the referenced attribute.getModel()Return the bindable object that corresponds to the path expression.Path<?> Return the parent "node" in the path or null if no parent.Downcast the type of the path to the given type.Expression<Class<? extends X>> type()Create an expression corresponding to the type of the path.Methods inherited from interface Expression
as, cast, coalesce, coalesce, count, countDistinct, equalTo, equalTo, in, in, in, in, in, isMember, isNotMember, isNotNull, isNull, notEqualTo, notEqualTo, nullif, nullif, selectCaseMethods inherited from interface Selection
alias, getCompoundSelectionItems, isCompoundSelectionMethods inherited from interface TupleElement
getAlias, getJavaType
-
Method Details
-
getModel
-
getParentPath
Return the parent "node" in the path or null if no parent.- Returns:
- parent
-
get
Create a path corresponding to the referenced single-valued attribute.- Type Parameters:
Y- the type of the attribute- Parameters:
attribute- single-valued attribute- Returns:
- path corresponding to the referenced attribute
-
get
Create a path corresponding to the referenced single-valued attribute.- Parameters:
attribute- single-valued attribute- Returns:
- path corresponding to the referenced attribute
- Since:
- 4.0
-
get
@Nonnull <C extends Comparable<? super C>> ComparableExpression<C> get(@Nonnull ComparableAttribute<? super X, C> attribute) Create a path corresponding to the referenced single-valued attribute.- Type Parameters:
C- the comparable type of the attribute- Parameters:
attribute- single-valued attribute- Returns:
- path corresponding to the referenced attribute
- Since:
- 4.0
-
get
@Nonnull <T extends Temporal & Comparable<? super T>> TemporalExpression<T> get(@Nonnull TemporalAttribute<? super X, T> attribute) Create a path corresponding to the referenced single-valued attribute.- Type Parameters:
T- the temporal type of the attribute- Parameters:
attribute- single-valued attribute- Returns:
- path corresponding to the referenced attribute
- Since:
- 4.0
-
get
@Nonnull <N extends Number & Comparable<N>> NumericExpression<N> get(@Nonnull NumericAttribute<? super X, N> attribute) Create a path corresponding to the referenced single-valued attribute.- Type Parameters:
N- the numeric type of the attribute- Parameters:
attribute- single-valued attribute- Returns:
- path corresponding to the referenced attribute
- Since:
- 4.0
-
get
Create a path corresponding to the referenced single-valued attribute.- Parameters:
attribute- single-valued attribute- Returns:
- path corresponding to the referenced attribute
- Since:
- 4.0
-
get
@Nonnull <E, C extends Collection<E>> PluralExpression<C,E> get(@Nonnull PluralAttribute<? super X, C, E> collection) Create a path corresponding to the referenced collection-valued attribute.- Type Parameters:
E- the element type of the collectionC- the collection type- Parameters:
collection- collection-valued attribute- Returns:
- expression corresponding to the referenced attribute
-
get
@Nonnull <K, V, M extends Map<K,V>> PluralExpression<M,V> get(@Nonnull MapAttribute<? super X, K, V> map) Create a path corresponding to the referenced map-valued attribute.- Type Parameters:
K- the key type of the mapV- the value type of the mapM- the map type- Parameters:
map- map-valued attribute- Returns:
- expression corresponding to the referenced attribute
-
type
Create an expression corresponding to the type of the path.- Returns:
- expression corresponding to the type of the 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(SingularAttribute)operation in order to avoid the use ofPathvariables.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));- Type Parameters:
Y- the type of the attribute- Parameters:
attributeName- the name of an attribute of the managed type of the path- Returns:
- path corresponding to the referenced attribute
- Throws:
IllegalStateException- if invoked on a path that corresponds to a basic typeIllegalArgumentException- if there is no attribute with the given name- API note:
- This method accepts a string-valued attribute name,
and lacks type safety compared to passing a static
metamodel element to
get(SingularAttribute). Use of the typesafe version is strongly preferred.
-
treat
-