Class DefaultEnhancementContext
- java.lang.Object
-
- org.hibernate.bytecode.enhance.spi.DefaultEnhancementContext
-
- All Implemented Interfaces:
EnhancementContext
- Direct Known Subclasses:
EnhancerTestContext
public class DefaultEnhancementContext extends Object implements EnhancementContext
default implementation of EnhancementContext. May be sub-classed as needed.
-
-
Constructor Summary
Constructors Constructor Description DefaultEnhancementContext()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
doBiDirectionalAssociationManagement(UnloadedField field)
Should we manage association of bi-directional persistent attributes for this field?boolean
doDirtyCheckingInline(UnloadedClass classDescriptor)
Should we in-line dirty checking for persistent attributes for this class?boolean
doExtendedEnhancement(UnloadedClass classDescriptor)
Should we enhance field access to entities from this class?ClassLoader
getLoadingClassLoader()
Obtain access to the ClassLoader that can be used to load Class references.boolean
hasLazyLoadableAttributes(UnloadedClass classDescriptor)
Does the given class define any lazy loadable attributes?boolean
isCompositeClass(UnloadedClass classDescriptor)
look for @Embeddable annotationboolean
isDiscoveredType(UnloadedClass classDescriptor)
boolean
isEntityClass(UnloadedClass classDescriptor)
look for @Entity annotationboolean
isLazyLoadable(UnloadedField field)
Determine if a field is lazy loadable.boolean
isMappedCollection(UnloadedField field)
look for @OneToMany, @ManyToMany and @ElementCollection annotationsboolean
isMappedSuperclassClass(UnloadedClass classDescriptor)
look for @MappedSuperclass annotationboolean
isPersistentField(UnloadedField ctField)
look for @Transient annotationUnloadedField[]
order(UnloadedField[] persistentFields)
keep the same order.void
registerDiscoveredType(UnloadedClass classDescriptor, Type.PersistenceType type)
-
-
-
Method Detail
-
getLoadingClassLoader
public ClassLoader getLoadingClassLoader()
Description copied from interface:EnhancementContext
Obtain access to the ClassLoader that can be used to load Class references. In JPA SPI terms, this should be a "temporary class loader" as defined byPersistenceUnitInfo.getNewTempClassLoader()
- Specified by:
getLoadingClassLoader
in interfaceEnhancementContext
- Returns:
- the classloader for this class
-
isEntityClass
public boolean isEntityClass(UnloadedClass classDescriptor)
look for @Entity annotation- Specified by:
isEntityClass
in interfaceEnhancementContext
- Parameters:
classDescriptor
- The descriptor of the class to check.- Returns:
true
if the class is an entity;false
otherwise.
-
isCompositeClass
public boolean isCompositeClass(UnloadedClass classDescriptor)
look for @Embeddable annotation- Specified by:
isCompositeClass
in interfaceEnhancementContext
- Parameters:
classDescriptor
- The descriptor of the class to check.- Returns:
true
if the class is an embeddable/component;false
otherwise.
-
isMappedSuperclassClass
public boolean isMappedSuperclassClass(UnloadedClass classDescriptor)
look for @MappedSuperclass annotation- Specified by:
isMappedSuperclassClass
in interfaceEnhancementContext
- Parameters:
classDescriptor
- The descriptor of the class to check.- Returns:
true
if the class is a mapped super class;false
otherwise.
-
doBiDirectionalAssociationManagement
public boolean doBiDirectionalAssociationManagement(UnloadedField field)
Description copied from interface:EnhancementContext
Should we manage association of bi-directional persistent attributes for this field?- Specified by:
doBiDirectionalAssociationManagement
in interfaceEnhancementContext
- Parameters:
field
- The field to check.- Returns:
- true
-
doDirtyCheckingInline
public boolean doDirtyCheckingInline(UnloadedClass classDescriptor)
Description copied from interface:EnhancementContext
Should we in-line dirty checking for persistent attributes for this class?- Specified by:
doDirtyCheckingInline
in interfaceEnhancementContext
- Parameters:
classDescriptor
- The descriptor of the class to check.- Returns:
- true
-
doExtendedEnhancement
public boolean doExtendedEnhancement(UnloadedClass classDescriptor)
Description copied from interface:EnhancementContext
Should we enhance field access to entities from this class?- Specified by:
doExtendedEnhancement
in interfaceEnhancementContext
- Parameters:
classDescriptor
- The descriptor of the class to check.- Returns:
- false
-
hasLazyLoadableAttributes
public boolean hasLazyLoadableAttributes(UnloadedClass classDescriptor)
Description copied from interface:EnhancementContext
Does the given class define any lazy loadable attributes?- Specified by:
hasLazyLoadableAttributes
in interfaceEnhancementContext
- Parameters:
classDescriptor
- The class to check- Returns:
- true
-
isLazyLoadable
public boolean isLazyLoadable(UnloadedField field)
Description copied from interface:EnhancementContext
Determine if a field is lazy loadable.- Specified by:
isLazyLoadable
in interfaceEnhancementContext
- Parameters:
field
- The field to check- Returns:
- true
-
isPersistentField
public boolean isPersistentField(UnloadedField ctField)
look for @Transient annotation- Specified by:
isPersistentField
in interfaceEnhancementContext
- Parameters:
ctField
- The field reference.- Returns:
true
if the field is ;false
otherwise.
-
isMappedCollection
public boolean isMappedCollection(UnloadedField field)
look for @OneToMany, @ManyToMany and @ElementCollection annotations- Specified by:
isMappedCollection
in interfaceEnhancementContext
- Parameters:
field
- the field to check- Returns:
true
if the field is mapped
-
order
public UnloadedField[] order(UnloadedField[] persistentFields)
keep the same order.- Specified by:
order
in interfaceEnhancementContext
- Parameters:
persistentFields
- The persistent field references.- Returns:
- The ordered references.
-
isDiscoveredType
public boolean isDiscoveredType(UnloadedClass classDescriptor)
- Specified by:
isDiscoveredType
in interfaceEnhancementContext
-
registerDiscoveredType
public void registerDiscoveredType(UnloadedClass classDescriptor, Type.PersistenceType type)
- Specified by:
registerDiscoveredType
in interfaceEnhancementContext
-
-