Top Description Inners Constructors Methods
org.hibernate.jpa.internal.util

public final Class PersistenceUtilHelper

extends Object
Class Inheritance
Imports
java.io.Serializable, java.lang.reflect.Field, .InvocationTargetException, .Method, java.security.AccessController, .PrivilegedAction, java.util.ArrayList, .HashMap, .List, .Map, .WeakHashMap, javax.persistence.spi.LoadState, org.hibernate.HibernateException, org.hibernate.bytecode.enhance.spi.interceptor.BytecodeLazyAttributeInterceptor, .LazyAttributeLoadingInterceptor, org.hibernate.collection.spi.PersistentCollection, org.hibernate.engine.spi.PersistentAttributeInterceptable, org.hibernate.internal.util.ReflectHelper, org.hibernate.proxy.HibernateProxy, .LazyInitializer

Central delegate for handling calls from:
Authors
Emmanuel Bernard, Hardy Ferentschik, Steve Ebersole

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
public static class
public static class
public static class
public static class
PersistenceUtilHelper.MetadataCache

Cache hierarchy and member resolution in a weak hash map

public static class
private static class

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static BytecodeLazyAttributeInterceptor
extractInterceptor(PersistentAttributeInterceptable interceptable)

Deprecated as a consequence of BytecodeLazyAttributeInterceptor being deprecated.
private static Method

Returns:

Returns the method with the specified name or null if it does not exist.
getMethod
(Class<?>
The class to check.
clazz
,
String
The attribute name.
attributeName
)

Returns the method with the specified name or null if it does not exist.

private static boolean
public static LoadState

Returns:

The appropriate LoadState (see above)
isLoaded
(Object
The object reference to check.
reference
)

Determine if the given object reference represents loaded state.

public static LoadState

Returns:

The LoadState
isLoadedWithoutReference
(Object
The entity
entity
,
String
The name of the attribute to check
attributeName
,
PersistenceUtilHelper.MetadataCache
The cache we maintain of attribute resolutions
cache
)

Is the given attribute (by name) loaded?

public static LoadState

Returns:

The LoadState
isLoadedWithReference
(Object
The entity
entity
,
String
The name of the attribute to check
attributeName
,
PersistenceUtilHelper.MetadataCache
The cache we maintain of attribute resolutions
cache
)

Is the given attribute (by name) loaded?

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

PersistenceUtilHelperback to summary
private PersistenceUtilHelper()

Method Detail

extractInterceptorback to summary
private static BytecodeLazyAttributeInterceptor extractInterceptor(PersistentAttributeInterceptable interceptable)

Deprecated

as a consequence of BytecodeLazyAttributeInterceptor being deprecated. See corresponding docs for further information.

getMethodback to summary
private static Method getMethod(Class<?> clazz, String attributeName)

Returns the method with the specified name or null if it does not exist.

Parameters
clazz:Class<?>

The class to check.

attributeName:String

The attribute name.

Returns:Method

Returns the method with the specified name or null if it does not exist.

isInitializedback to summary
private static boolean isInitialized(PersistentAttributeInterceptable interceptable)
Annotations
@SuppressWarnings:SimplifiableIfStatement
isLoadedback to summary
public static LoadState isLoaded(Object reference)

Determine if the given object reference represents loaded state. The reference may be to an entity or a persistent collection.

Return is defined as follows:

  1. If the reference is a HibernateProxy, we return LoadState#LOADED if org.hibernate.proxy.LazyInitializer#isUninitialized() returns false; else we return LoadState#NOT_LOADED
  2. If the reference is an enhanced (by Hibernate) entity, we return LoadState#LOADED if LazyAttributeLoadingInterceptor#hasAnyUninitializedAttributes() returns false; otherwise we return LoadState#NOT_LOADED
  3. If the reference is a PersistentCollection, we return LoadState#LOADED if org.hibernate.collection.spi.PersistentCollection#wasInitialized() returns true; else we return LoadState#NOT_LOADED
  4. In all other cases we return LoadState#UNKNOWN
Parameters
reference:Object

The object reference to check.

Returns:LoadState

The appropriate LoadState (see above)

isLoadedWithoutReferenceback to summary
public static LoadState isLoadedWithoutReference(Object entity, String attributeName, PersistenceUtilHelper.MetadataCache cache)

Is the given attribute (by name) loaded? This form must take care to not access the attribute (trigger initialization).

Parameters
entity:Object

The entity

attributeName:String

The name of the attribute to check

cache:PersistenceUtilHelper.MetadataCache

The cache we maintain of attribute resolutions

Returns:LoadState

The LoadState

isLoadedWithReferenceback to summary
public static LoadState isLoadedWithReference(Object entity, String attributeName, PersistenceUtilHelper.MetadataCache cache)

Is the given attribute (by name) loaded? This form must take care to not access the attribute (trigger initialization).

Parameters
entity:Object

The entity

attributeName:String

The name of the attribute to check

cache:PersistenceUtilHelper.MetadataCache

The cache we maintain of attribute resolutions

Returns:LoadState

The LoadState

org.hibernate.jpa.internal.util back to summary

public Interface PersistenceUtilHelper.AttributeAccess

Known Direct Implementers
org.hibernate.jpa.internal.util.PersistenceUtilHelper.FieldAttributeAccess, org.hibernate.jpa.internal.util.PersistenceUtilHelper.MethodAttributeAccess, org.hibernate.jpa.internal.util.PersistenceUtilHelper.NoSuchAttributeAccess

Method Summary

Modifier and TypeMethod and Description
public Object

Method Detail

extractValueback to summary
public Object extractValue(Object owner) throws AttributeExtractionException
org.hibernate.jpa.internal.util back to summary

public Class PersistenceUtilHelper.AttributeExtractionException

extends HibernateException
Class Inheritance

Constructor Summary

AccessConstructor and Description
public
public

Constructor Detail

AttributeExtractionExceptionback to summary
public AttributeExtractionException(String message)
AttributeExtractionExceptionback to summary
public AttributeExtractionException(String message, Throwable cause)
org.hibernate.jpa.internal.util back to summary

public Class PersistenceUtilHelper.ClassMetadataCache

extends Object
Class Inheritance
  • java.lang.Object
  • org.hibernate.jpa.internal.util.PersistenceUtilHelper.ClassMetadataCache

Field Summary

Modifier and TypeField and Description
private Map<String, PersistenceUtilHelper.AttributeAccess>
private List<Class<?>>
private final Class<T>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private PersistenceUtilHelper.AttributeAccess
buildAttributeAccess(final String attributeName)

private static List<Class<?>>
public PersistenceUtilHelper.AttributeAccess
getAttributeAccess(String attributeName)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attributeAccessMapback to summary
private Map<String, PersistenceUtilHelper.AttributeAccess> attributeAccessMap
classHierarchyback to summary
private List<Class<?>> classHierarchy
specifiedClassback to summary
private final Class<T> specifiedClass

Constructor Detail

ClassMetadataCacheback to summary
public ClassMetadataCache(Class<?> clazz)

Method Detail

buildAttributeAccessback to summary
private PersistenceUtilHelper.AttributeAccess buildAttributeAccess(final String attributeName)
findClassHierarchyback to summary
private static List<Class<?>> findClassHierarchy(Class<?> clazz)
getAttributeAccessback to summary
public PersistenceUtilHelper.AttributeAccess getAttributeAccess(String attributeName)
org.hibernate.jpa.internal.util back to summary

public Class PersistenceUtilHelper.FieldAttributeAccess

extends Object
implements AttributeAccess
Class Inheritance
  • java.lang.Object
  • org.hibernate.jpa.internal.util.PersistenceUtilHelper.FieldAttributeAccess
All Implemented Interfaces
org.hibernate.jpa.internal.util.PersistenceUtilHelper.AttributeAccess

Field Summary

Modifier and TypeField and Description
private final Field
private final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fieldback to summary
private final Field field
nameback to summary
private final String name

Constructor Detail

FieldAttributeAccessback to summary
public FieldAttributeAccess(Field field)

Method Detail

extractValueback to summary
public Object extractValue(Object owner)

Implements org.hibernate.jpa.internal.util.PersistenceUtilHelper.AttributeAccess.extractValue.

Annotations
@Override
org.hibernate.jpa.internal.util back to summary

public Class PersistenceUtilHelper.MetadataCache

extends Object
implements Serializable
Class Inheritance
  • java.lang.Object
  • org.hibernate.jpa.internal.util.PersistenceUtilHelper.MetadataCache
All Implemented Interfaces
java.io.Serializable

Cache hierarchy and member resolution in a weak hash map

Field Summary

Modifier and TypeField and Description
private transient Map<Class<?>, PersistenceUtilHelper.ClassMetadataCache>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv PersistenceUtilHelper.ClassMetadataCache
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

classCacheback to summary
private transient Map<Class<?>, PersistenceUtilHelper.ClassMetadataCache> classCache

Constructor Detail

MetadataCacheback to summary
public MetadataCache()

Method Detail

getClassMetadataback to summary
pack-priv PersistenceUtilHelper.ClassMetadataCache getClassMetadata(Class<?> clazz)
readObjectback to summary
private void readObject(ObjectInputStream stream)
org.hibernate.jpa.internal.util back to summary

public Class PersistenceUtilHelper.MethodAttributeAccess

extends Object
implements AttributeAccess
Class Inheritance
  • java.lang.Object
  • org.hibernate.jpa.internal.util.PersistenceUtilHelper.MethodAttributeAccess
All Implemented Interfaces
org.hibernate.jpa.internal.util.PersistenceUtilHelper.AttributeAccess

Field Summary

Modifier and TypeField and Description
private final Method
private final String

Constructor Summary

AccessConstructor and Description
public
MethodAttributeAccess(String attributeName, Method method)

Method Summary

Modifier and TypeMethod and Description
public Object
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

methodback to summary
private final Method method
nameback to summary
private final String name

Constructor Detail

MethodAttributeAccessback to summary
public MethodAttributeAccess(String attributeName, Method method)

Method Detail

extractValueback to summary
public Object extractValue(Object owner)

Implements org.hibernate.jpa.internal.util.PersistenceUtilHelper.AttributeAccess.extractValue.

Annotations
@Override
org.hibernate.jpa.internal.util back to summary

private Class PersistenceUtilHelper.NoSuchAttributeAccess

extends Object
implements AttributeAccess
Class Inheritance
  • java.lang.Object
  • org.hibernate.jpa.internal.util.PersistenceUtilHelper.NoSuchAttributeAccess
All Implemented Interfaces
org.hibernate.jpa.internal.util.PersistenceUtilHelper.AttributeAccess

Field Summary

Modifier and TypeField and Description
private final String
private final Class<T>

Constructor Summary

AccessConstructor and Description
public
NoSuchAttributeAccess(Class<T> clazz, String attributeName)

Method Summary

Modifier and TypeMethod and Description
public Object
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attributeNameback to summary
private final String attributeName
clazzback to summary
private final Class<T> clazz

Constructor Detail

NoSuchAttributeAccessback to summary
public NoSuchAttributeAccess(Class<T> clazz, String attributeName)

Method Detail

extractValueback to summary
public Object extractValue(Object owner) throws AttributeExtractionException

Implements org.hibernate.jpa.internal.util.PersistenceUtilHelper.AttributeAccess.extractValue.

Annotations
@Override