Class DefaultEnhancementContext
- java.lang.Object
-
- org.hibernate.bytecode.enhance.spi.DefaultEnhancementContext
-
- All Implemented Interfaces:
EnhancementContext
- Direct Known Subclasses:
EnhancerTestContext
public class DefaultEnhancementContext extends java.lang.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 booleandoBiDirectionalAssociationManagement(UnloadedField field)Should we manage association of bi-directional persistent attributes for this field?booleandoDirtyCheckingInline(UnloadedClass classDescriptor)Should we in-line dirty checking for persistent attributes for this class?booleandoExtendedEnhancement(UnloadedClass classDescriptor)Should we enhance field access to entities from this class?java.lang.ClassLoadergetLoadingClassLoader()Obtain access to the ClassLoader that can be used to load Class references.booleanhasLazyLoadableAttributes(UnloadedClass classDescriptor)Does the given class define any lazy loadable attributes?booleanisCompositeClass(UnloadedClass classDescriptor)look for @Embeddable annotationbooleanisEntityClass(UnloadedClass classDescriptor)look for @Entity annotationbooleanisLazyLoadable(UnloadedField field)Determine if a field is lazy loadable.booleanisMappedCollection(UnloadedField field)look for @OneToMany, @ManyToMany and @ElementCollection annotationsbooleanisMappedSuperclassClass(UnloadedClass classDescriptor)look for @MappedSuperclass annotationbooleanisPersistentField(UnloadedField ctField)look for @Transient annotationUnloadedField[]order(UnloadedField[] persistentFields)keep the same order.
-
-
-
Method Detail
-
getLoadingClassLoader
public java.lang.ClassLoader getLoadingClassLoader()
Description copied from interface:EnhancementContextObtain 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:
getLoadingClassLoaderin interfaceEnhancementContext- Returns:
- the classloader for this class
-
isEntityClass
public boolean isEntityClass(UnloadedClass classDescriptor)
look for @Entity annotation- Specified by:
isEntityClassin interfaceEnhancementContext- Parameters:
classDescriptor- The descriptor of the class to check.- Returns:
trueif the class is an entity;falseotherwise.
-
isCompositeClass
public boolean isCompositeClass(UnloadedClass classDescriptor)
look for @Embeddable annotation- Specified by:
isCompositeClassin interfaceEnhancementContext- Parameters:
classDescriptor- The descriptor of the class to check.- Returns:
trueif the class is an embeddable/component;falseotherwise.
-
isMappedSuperclassClass
public boolean isMappedSuperclassClass(UnloadedClass classDescriptor)
look for @MappedSuperclass annotation- Specified by:
isMappedSuperclassClassin interfaceEnhancementContext- Parameters:
classDescriptor- The descriptor of the class to check.- Returns:
trueif the class is a mapped super class;falseotherwise.
-
doBiDirectionalAssociationManagement
public boolean doBiDirectionalAssociationManagement(UnloadedField field)
Description copied from interface:EnhancementContextShould we manage association of bi-directional persistent attributes for this field?- Specified by:
doBiDirectionalAssociationManagementin interfaceEnhancementContext- Parameters:
field- The field to check.- Returns:
- true
-
doDirtyCheckingInline
public boolean doDirtyCheckingInline(UnloadedClass classDescriptor)
Description copied from interface:EnhancementContextShould we in-line dirty checking for persistent attributes for this class?- Specified by:
doDirtyCheckingInlinein interfaceEnhancementContext- Parameters:
classDescriptor- The descriptor of the class to check.- Returns:
- true
-
doExtendedEnhancement
public boolean doExtendedEnhancement(UnloadedClass classDescriptor)
Description copied from interface:EnhancementContextShould we enhance field access to entities from this class?- Specified by:
doExtendedEnhancementin interfaceEnhancementContext- Parameters:
classDescriptor- The descriptor of the class to check.- Returns:
- false
-
hasLazyLoadableAttributes
public boolean hasLazyLoadableAttributes(UnloadedClass classDescriptor)
Description copied from interface:EnhancementContextDoes the given class define any lazy loadable attributes?- Specified by:
hasLazyLoadableAttributesin interfaceEnhancementContext- Parameters:
classDescriptor- The class to check- Returns:
- true
-
isLazyLoadable
public boolean isLazyLoadable(UnloadedField field)
Description copied from interface:EnhancementContextDetermine if a field is lazy loadable.- Specified by:
isLazyLoadablein interfaceEnhancementContext- Parameters:
field- The field to check- Returns:
- true
-
isPersistentField
public boolean isPersistentField(UnloadedField ctField)
look for @Transient annotation- Specified by:
isPersistentFieldin interfaceEnhancementContext- Parameters:
ctField- The field reference.- Returns:
trueif the field is ;falseotherwise.
-
isMappedCollection
public boolean isMappedCollection(UnloadedField field)
look for @OneToMany, @ManyToMany and @ElementCollection annotations- Specified by:
isMappedCollectionin interfaceEnhancementContext- Parameters:
field- the field to check- Returns:
trueif the field is mapped
-
order
public UnloadedField[] order(UnloadedField[] persistentFields)
keep the same order.- Specified by:
orderin interfaceEnhancementContext- Parameters:
persistentFields- The persistent field references.- Returns:
- The ordered references.
-
-