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

public Class MapKeyHelpers

extends Object
Class Inheritance
Imports
java.io.Serializable, java.lang.reflect.Member, java.util.Map, javax.persistence.metamodel.Attribute, .Bindable, .ManagedType, .MapAttribute, .SingularAttribute, .Type, org.hibernate.engine.spi.SessionFactoryImplementor, org.hibernate.query.criteria.internal.CriteriaBuilderImpl, .MapJoinImplementor, .PathImplementor, .PathSource, org.hibernate.query.criteria.internal.compile.RenderingContext, org.hibernate.persister.collection.CollectionPersister

javax.persistence.criteria.MapJoin#key poses a number of implementation difficulties in terms of the type signatures amongst the javax.persistence.criteria.Path, javax.persistence.criteria.Join and Attribute. The implementations found here provide that bridge.
Author
Steve Ebersole

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
MapKeyHelpers.MapKeyAttribute<
The type of the map key
K
>

Defines an javax.persistence.metamodel.Attribute modelling of a map-key.

public static class
MapKeyHelpers.MapKeyPath<
The type of the map key.
K
>

Models a path to a map key.

public static class
MapKeyHelpers.MapKeySource<
The map key type
K
,
The map value type
V
>

Defines a path for the map which can then be used to represent the source of the map key "attribute".

Constructor Summary

AccessConstructor and Description
private
MapKeyHelpers()

Disallow instantiation

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

MapKeyHelpersback to summary
private MapKeyHelpers()

Disallow instantiation

org.hibernate.query.criteria.internal.path back to summary

public Class MapKeyHelpers.MapKeyAttribute<K>

extends Object
implements SingularAttribute<Map<K, ?>, K>, Bindable<K>, Serializable
Class Inheritance
  • java.lang.Object
  • org.hibernate.query.criteria.internal.path.MapKeyHelpers.MapKeyAttribute
All Implemented Interfaces
java.io.Serializable, javax.persistence.metamodel.Bindable, javax.persistence.metamodel.SingularAttribute, javax.persistence.metamodel.Attribute
Type Parameters
<K>
The type of the map key

Defines an javax.persistence.metamodel.Attribute modelling of a map-key.

Field Summary

Modifier and TypeField and Description
private final MapAttribute<?, K, ?>
private final Class<K>
private final Bindable.BindableType
private final Type<K>
private final Type
private final CollectionPersister
private final Attribute.PersistentAttributeType

Constructor Summary

AccessConstructor and Description
public
MapKeyAttribute(CriteriaBuilderImpl criteriaBuilder, MapAttribute<?, K, ?> attribute)

Method Summary

Modifier and TypeMethod and Description
private String
determineRole(MapAttribute<?, K, ?> attribute)

public Class<K>
getBindableJavaType()

Implements javax.persistence.metamodel.Bindable.getBindableJavaType.

Return the Java type of the represented object.
public Bindable.BindableType
getBindableType()

Implements javax.persistence.metamodel.Bindable.getBindableType.

Return the bindable type of the represented object.
public ManagedType<Map<K, ?>>
getDeclaringType()

Implements javax.persistence.metamodel.Attribute.getDeclaringType.

Return the managed type representing the type in which the attribute was declared.
public Member
getJavaMember()

Implements javax.persistence.metamodel.Attribute.getJavaMember.

Return the java.lang.reflect.Member for the represented attribute.
public Class<K>
getJavaType()

Implements javax.persistence.metamodel.Attribute.getJavaType.

Return the Java type of the represented attribute.
public String
getName()

Implements javax.persistence.metamodel.Attribute.getName.

Return the name of the attribute.
public Attribute.PersistentAttributeType
getPersistentAttributeType()

Implements javax.persistence.metamodel.Attribute.getPersistentAttributeType.

Return the persistent attribute type for the attribute.
public Type<K>
getType()

Implements javax.persistence.metamodel.SingularAttribute.getType.

Return the type that represents the type of the attribute.
public boolean
isAssociation()

Implements javax.persistence.metamodel.Attribute.isAssociation.

Is the attribute an association.
public boolean
isCollection()

Implements javax.persistence.metamodel.Attribute.isCollection.

Is the attribute collection-valued (represents a Collection, Set, List, or Map).
public boolean
isId()

Implements javax.persistence.metamodel.SingularAttribute.isId.

Is the attribute an id attribute.
public boolean
public boolean
isVersion()

Implements javax.persistence.metamodel.SingularAttribute.isVersion.

Is the attribute a version attribute.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attributeback to summary
private final MapAttribute<?, K, ?> attribute
jpaBinableJavaTypeback to summary
private final Class<K> jpaBinableJavaType
jpaBindableTypeback to summary
private final Bindable.BindableType jpaBindableType
jpaTypeback to summary
private final Type<K> jpaType
mapKeyTypeback to summary
private final Type mapKeyType
mapPersisterback to summary
private final CollectionPersister mapPersister
persistentAttributeTypeback to summary
private final Attribute.PersistentAttributeType persistentAttributeType

Constructor Detail

MapKeyAttributeback to summary
public MapKeyAttribute(CriteriaBuilderImpl criteriaBuilder, MapAttribute<?, K, ?> attribute)

Method Detail

determineRoleback to summary
private String determineRole(MapAttribute<?, K, ?> attribute)
getBindableJavaTypeback to summary
public Class<K> getBindableJavaType()

Implements javax.persistence.metamodel.Bindable.getBindableJavaType.

Doc from javax.persistence.metamodel.Bindable.getBindableJavaType.

Return the Java type of the represented object. If the bindable type of the object is PLURAL_ATTRIBUTE, the Java element type is returned. If the bindable type is SINGULAR_ATTRIBUTE or ENTITY_TYPE, the Java type of the represented entity or attribute is returned.

Returns:Class<K>

Java type

Annotations
@Override
getBindableTypeback to summary
public Bindable.BindableType getBindableType()

Implements javax.persistence.metamodel.Bindable.getBindableType.

Doc from javax.persistence.metamodel.Bindable.getBindableType.

Return the bindable type of the represented object.

Returns:Bindable.BindableType

bindable type

Annotations
@Override
getDeclaringTypeback to summary
public ManagedType<Map<K, ?>> getDeclaringType()

Implements javax.persistence.metamodel.Attribute.getDeclaringType.

Doc from javax.persistence.metamodel.Attribute.getDeclaringType.

Return the managed type representing the type in which the attribute was declared.

Returns:ManagedType<Map<K, ?>>

declaring type

Annotations
@Override
getJavaMemberback to summary
public Member getJavaMember()

Implements javax.persistence.metamodel.Attribute.getJavaMember.

Doc from javax.persistence.metamodel.Attribute.getJavaMember.

Return the java.lang.reflect.Member for the represented attribute.

Returns:Member

corresponding java.lang.reflect.Member

Annotations
@Override
getJavaTypeback to summary
public Class<K> getJavaType()

Implements javax.persistence.metamodel.Attribute.getJavaType.

Doc from javax.persistence.metamodel.Attribute.getJavaType.

Return the Java type of the represented attribute.

Returns:Class<K>

Java type

Annotations
@Override
getNameback to summary
public String getName()

Implements javax.persistence.metamodel.Attribute.getName.

Doc from javax.persistence.metamodel.Attribute.getName.

Return the name of the attribute.

Returns:String

name

Annotations
@Override
getPersistentAttributeTypeback to summary
public Attribute.PersistentAttributeType getPersistentAttributeType()

Implements javax.persistence.metamodel.Attribute.getPersistentAttributeType.

Doc from javax.persistence.metamodel.Attribute.getPersistentAttributeType.

Return the persistent attribute type for the attribute.

Returns:Attribute.PersistentAttributeType

persistent attribute type

Annotations
@Override
getTypeback to summary
public Type<K> getType()

Implements javax.persistence.metamodel.SingularAttribute.getType.

Doc from javax.persistence.metamodel.SingularAttribute.getType.

Return the type that represents the type of the attribute.

Returns:Type<K>

type of attribute

Annotations
@Override
isAssociationback to summary
public boolean isAssociation()

Implements javax.persistence.metamodel.Attribute.isAssociation.

Doc from javax.persistence.metamodel.Attribute.isAssociation.

Is the attribute an association.

Returns:boolean

boolean indicating whether the attribute corresponds to an association

Annotations
@Override
isCollectionback to summary
public boolean isCollection()

Implements javax.persistence.metamodel.Attribute.isCollection.

Doc from javax.persistence.metamodel.Attribute.isCollection.

Is the attribute collection-valued (represents a Collection, Set, List, or Map).

Returns:boolean

boolean indicating whether the attribute is collection-valued

Annotations
@Override
isIdback to summary
public boolean isId()

Implements javax.persistence.metamodel.SingularAttribute.isId.

Doc from javax.persistence.metamodel.SingularAttribute.isId.

Is the attribute an id attribute. This method will return true if the attribute is an attribute that corresponds to a simple id, an embedded id, or an attribute of an id class.

Returns:boolean

boolean indicating whether the attribute is an id

Annotations
@Override
isOptionalback to summary
public boolean isOptional()

Implements javax.persistence.metamodel.SingularAttribute.isOptional.

Doc from javax.persistence.metamodel.SingularAttribute.isOptional.

Can the attribute be null.

Returns:boolean

boolean indicating whether the attribute can be null

Annotations
@Override
isVersionback to summary
public boolean isVersion()

Implements javax.persistence.metamodel.SingularAttribute.isVersion.

Doc from javax.persistence.metamodel.SingularAttribute.isVersion.

Is the attribute a version attribute.

Returns:boolean

boolean indicating whether the attribute is a version attribute

Annotations
@Override
org.hibernate.query.criteria.internal.path back to summary

public Class MapKeyHelpers.MapKeyPath<K>

extends AbstractPathImpl<K>
implements PathImplementor<K>, 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
Type Parameters
<K>
The type of the map key.

Models a path to a map key. This is the actual return used from javax.persistence.criteria.MapJoin#key

Field Summary

Modifier and TypeField and Description
private final MapKeyHelpers.MapKeyAttribute<K>

Constructor Summary

AccessConstructor and Description
public
MapKeyPath(CriteriaBuilderImpl criteriaBuilder, MapKeyHelpers.MapKeySource<K, ?> source, MapKeyHelpers.MapKeyAttribute<K> mapKeyAttribute)

Method Summary

Modifier and TypeMethod and Description
protected boolean
public MapKeyHelpers.MapKeyAttribute<K>
getAttribute()

Implements org.hibernate.query.criteria.internal.PathImplementor.getAttribute.

Retrieve reference to the attribute this path represents.
public Bindable<K>
getModel()

Implements javax.persistence.criteria.Path.getModel.

Return the bindable object that corresponds to the path expression.
public MapKeyHelpers.MapKeySource<K, V>
private boolean
protected Attribute<X, Y>
locateAttributeInternal(String
The name of the attribute to locate
attributeName
)

Implements abstract org.hibernate.query.criteria.internal.path.AbstractPathImpl.locateAttributeInternal.

Get the attribute by name from the underlying model.
public String
public <T extends K> MapKeyHelpers.MapKeyPath<T>
treatAs(Class<T>
The type to treat the path as.
treatAsType
)

Implements org.hibernate.query.criteria.internal.PathImplementor.treatAs.

Defines handling for the JPA 2.1 TREAT down-casting feature.
Inherited from org.hibernate.query.criteria.internal.path.AbstractPathImpl:
getgetgetgetgetParentPathgetPathIdentifiergetPathSourceForSubPathsillegalDereferencelocateAttributeprepareAliasregisterAttributePathregisterParametersresolveCachedAttributePathtypeunknownAttribute

Field Detail

mapKeyAttributeback to summary
private final MapKeyHelpers.MapKeyAttribute<K> mapKeyAttribute

Constructor Detail

MapKeyPathback to summary
public MapKeyPath(CriteriaBuilderImpl criteriaBuilder, MapKeyHelpers.MapKeySource<K, ?> source, MapKeyHelpers.MapKeyAttribute<K> mapKeyAttribute)

Method Detail

canBeDereferencedback to summary
protected boolean canBeDereferenced()

Implements abstract org.hibernate.query.criteria.internal.path.AbstractPathImpl.canBeDereferenced.

Annotations
@Override
getAttributeback to summary
public MapKeyHelpers.MapKeyAttribute<K> getAttribute()

Implements org.hibernate.query.criteria.internal.PathImplementor.getAttribute.

Doc from org.hibernate.query.criteria.internal.PathImplementor.getAttribute.

Retrieve reference to the attribute this path represents.

Returns:MapKeyHelpers.MapKeyAttribute<K>

The metamodel attribute.

getModelback to summary
public Bindable<K> getModel()

Implements javax.persistence.criteria.Path.getModel.

Doc from javax.persistence.criteria.Path.getModel.

Return the bindable object that corresponds to the path expression.

Returns:Bindable<K>

bindable object corresponding to the path

getPathSourceback to summary
public MapKeyHelpers.MapKeySource<K, V> getPathSource()

Overrides org.hibernate.query.criteria.internal.path.AbstractPathImpl.getPathSource.

Annotations
@Override
isBasicTypeKeyback to summary
private boolean isBasicTypeKey()
locateAttributeInternalback to summary
protected Attribute<X, Y> locateAttributeInternal(String attributeName)

Implements abstract org.hibernate.query.criteria.internal.path.AbstractPathImpl.locateAttributeInternal.

Doc from org.hibernate.query.criteria.internal.path.AbstractPathImpl.locateAttributeInternal.

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.

Annotations
@Override
renderback to summary
public String render(RenderingContext renderingContext)

Overrides org.hibernate.query.criteria.internal.path.AbstractPathImpl.render.

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
treatAsback to summary
public <T extends K> MapKeyHelpers.MapKeyPath<T> treatAs(Class<T> treatAsType)

Implements org.hibernate.query.criteria.internal.PathImplementor.treatAs.

Doc from org.hibernate.query.criteria.internal.PathImplementor.treatAs.

Defines handling for the JPA 2.1 TREAT down-casting feature.

Parameters
<T>
The parameterized type representation of treatAsType.
treatAsType:Class<T>

The type to treat the path as.

Returns:MapKeyHelpers.MapKeyPath<T>

The properly typed view of this path.

Annotations
@Override
@SuppressWarnings:unchecked
org.hibernate.query.criteria.internal.path back to summary

public Class MapKeyHelpers.MapKeySource<K, V>

extends AbstractPathImpl<Map<K, V>>
implements PathImplementor<Map<K, V>>, 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
Type Parameters
<K>
The map key type
<V>
The map value type

Defines a path for the map which can then be used to represent the source of the map key "attribute".

Field Summary

Modifier and TypeField and Description
private final MapAttribute<?, K, V>
private final MapJoinImplementor<?, K, V>

Constructor Summary

AccessConstructor and Description
public
MapKeySource(CriteriaBuilderImpl criteriaBuilder, Class<Map<K, V>> javaType, MapJoinImplementor<?, K, V> mapJoin, MapAttribute<?, K, V> attribute)

Method Summary

Modifier and TypeMethod and Description
protected boolean
public MapAttribute<?, K, V>
getAttribute()

Implements org.hibernate.query.criteria.internal.PathImplementor.getAttribute.

Retrieve reference to the attribute this path represents.
public Bindable<Map<K, V>>
getModel()

Implements javax.persistence.criteria.Path.getModel.

Return the bindable object that corresponds to the path expression.
public PathImplementor<?>
public String
getPathIdentifier()

Overrides org.hibernate.query.criteria.internal.path.AbstractPathImpl.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
protected Attribute<X, Y>
locateAttributeInternal(String
The name of the attribute to locate
attributeName
)

Implements abstract org.hibernate.query.criteria.internal.path.AbstractPathImpl.locateAttributeInternal.

Get the attribute by name from the underlying model.
public void
public <T extends Map<K, V>> PathImplementor<T>
treatAs(Class<T>
The type to treat the path as.
treatAsType
)

Implements org.hibernate.query.criteria.internal.PathImplementor.treatAs.

Defines handling for the JPA 2.1 TREAT down-casting feature.
Inherited from org.hibernate.query.criteria.internal.path.AbstractPathImpl:
getgetgetgetgetPathSourcegetPathSourceForSubPathsillegalDereferencelocateAttributeregisterAttributePathregisterParametersrenderresolveCachedAttributePathtypeunknownAttribute

Field Detail

mapAttributeback to summary
private final MapAttribute<?, K, V> mapAttribute
mapJoinback to summary
private final MapJoinImplementor<?, K, V> mapJoin

Constructor Detail

MapKeySourceback to summary
public MapKeySource(CriteriaBuilderImpl criteriaBuilder, Class<Map<K, V>> javaType, MapJoinImplementor<?, K, V> mapJoin, MapAttribute<?, K, V> attribute)

Method Detail

canBeDereferencedback to summary
protected boolean canBeDereferenced()

Implements abstract org.hibernate.query.criteria.internal.path.AbstractPathImpl.canBeDereferenced.

Annotations
@Override
getAttributeback to summary
public MapAttribute<?, K, V> getAttribute()

Implements org.hibernate.query.criteria.internal.PathImplementor.getAttribute.

Doc from org.hibernate.query.criteria.internal.PathImplementor.getAttribute.

Retrieve reference to the attribute this path represents.

Returns:MapAttribute<?, K, V>

The metamodel attribute.

getModelback to summary
public Bindable<Map<K, V>> getModel()

Implements javax.persistence.criteria.Path.getModel.

Doc from javax.persistence.criteria.Path.getModel.

Return the bindable object that corresponds to the path expression.

Returns:Bindable<Map<K, V>>

bindable object corresponding to the path

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

Overrides org.hibernate.query.criteria.internal.path.AbstractPathImpl.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:PathImplementor<?>

parent

Annotations
@Override
getPathIdentifierback to summary
public String getPathIdentifier()

Overrides org.hibernate.query.criteria.internal.path.AbstractPathImpl.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
locateAttributeInternalback to summary
protected Attribute<X, Y> locateAttributeInternal(String attributeName)

Implements abstract org.hibernate.query.criteria.internal.path.AbstractPathImpl.locateAttributeInternal.

Doc from org.hibernate.query.criteria.internal.path.AbstractPathImpl.locateAttributeInternal.

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.

Annotations
@Override
prepareAliasback to summary
public void prepareAlias(RenderingContext renderingContext)

Overrides org.hibernate.query.criteria.internal.path.AbstractPathImpl.prepareAlias.

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

Annotations
@Override
treatAsback to summary
public <T extends Map<K, V>> PathImplementor<T> treatAs(Class<T> treatAsType)

Implements org.hibernate.query.criteria.internal.PathImplementor.treatAs.

Doc from org.hibernate.query.criteria.internal.PathImplementor.treatAs.

Defines handling for the JPA 2.1 TREAT down-casting feature.

Parameters
<T>
The parameterized type representation of treatAsType.
treatAsType:Class<T>

The type to treat the path as.

Returns:PathImplementor<T>

The properly typed view of this path.

Annotations
@Override