Package org.hibernate.bytecode.internal
Class BytecodeEnhancementMetadataPojoImpl
- java.lang.Object
-
- org.hibernate.bytecode.internal.BytecodeEnhancementMetadataPojoImpl
-
- All Implemented Interfaces:
BytecodeEnhancementMetadata
public final class BytecodeEnhancementMetadataPojoImpl extends Object implements BytecodeEnhancementMetadata
BytecodeEnhancementMetadata implementation forPOJO
models
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PersistentAttributeInterceptable
createEnhancedProxy(EntityKey entityKey, boolean addEmptyEntry, SharedSessionContractImplementor session)
Create an "enhancement as proxy" instance for the given entity@Nullable LazyAttributeLoadingInterceptor
extractInterceptor(Object entity)
Extract the field interceptor instance from the enhanced entity.@Nullable BytecodeLazyAttributeInterceptor
extractLazyInterceptor(Object entity)
static BytecodeEnhancementMetadata
from(PersistentClass persistentClass, Set<String> identifierAttributeNames, CompositeType nonAggregatedCidMapper, boolean collectionsInDefaultFetchGroupEnabled, Metadata metadata)
Static constructorString
getEntityName()
The name of the entity to which this metadata applies.LazyAttributesMetadata
getLazyAttributesMetadata()
boolean
hasUnFetchedAttributes(Object entity)
void
injectEnhancedEntityAsProxyInterceptor(Object entity, EntityKey entityKey, SharedSessionContractImplementor session)
LazyAttributeLoadingInterceptor
injectInterceptor(Object entity, Object identifier, SharedSessionContractImplementor session)
Build and inject an interceptor instance into the enhanced entity.void
injectInterceptor(Object entity, PersistentAttributeInterceptor interceptor, SharedSessionContractImplementor session)
boolean
isAttributeLoaded(Object entity, String attributeName)
boolean
isEnhancedForLazyLoading()
Has the entity class been bytecode enhanced for lazy loading?
-
-
-
Method Detail
-
from
public static BytecodeEnhancementMetadata from(PersistentClass persistentClass, Set<String> identifierAttributeNames, CompositeType nonAggregatedCidMapper, boolean collectionsInDefaultFetchGroupEnabled, Metadata metadata)
Static constructor
-
getEntityName
public String getEntityName()
Description copied from interface:BytecodeEnhancementMetadata
The name of the entity to which this metadata applies.- Specified by:
getEntityName
in interfaceBytecodeEnhancementMetadata
- Returns:
- The entity name
-
isEnhancedForLazyLoading
public boolean isEnhancedForLazyLoading()
Description copied from interface:BytecodeEnhancementMetadata
Has the entity class been bytecode enhanced for lazy loading?- Specified by:
isEnhancedForLazyLoading
in interfaceBytecodeEnhancementMetadata
- Returns:
true
indicates the entity class is enhanced for Hibernate use in lazy loading;false
indicates it is not
-
getLazyAttributesMetadata
public LazyAttributesMetadata getLazyAttributesMetadata()
- Specified by:
getLazyAttributesMetadata
in interfaceBytecodeEnhancementMetadata
-
hasUnFetchedAttributes
public boolean hasUnFetchedAttributes(Object entity)
- Specified by:
hasUnFetchedAttributes
in interfaceBytecodeEnhancementMetadata
-
isAttributeLoaded
public boolean isAttributeLoaded(Object entity, String attributeName)
- Specified by:
isAttributeLoaded
in interfaceBytecodeEnhancementMetadata
-
extractInterceptor
public @Nullable LazyAttributeLoadingInterceptor extractInterceptor(Object entity) throws NotInstrumentedException
Description copied from interface:BytecodeEnhancementMetadata
Extract the field interceptor instance from the enhanced entity.- Specified by:
extractInterceptor
in interfaceBytecodeEnhancementMetadata
- Parameters:
entity
- The entity from which to extract the interceptor- Returns:
- The extracted interceptor
- Throws:
NotInstrumentedException
- Thrown ifBytecodeEnhancementMetadata.isEnhancedForLazyLoading()
returnsfalse
-
createEnhancedProxy
public PersistentAttributeInterceptable createEnhancedProxy(EntityKey entityKey, boolean addEmptyEntry, SharedSessionContractImplementor session)
Description copied from interface:BytecodeEnhancementMetadata
Create an "enhancement as proxy" instance for the given entity- Specified by:
createEnhancedProxy
in interfaceBytecodeEnhancementMetadata
-
injectInterceptor
public LazyAttributeLoadingInterceptor injectInterceptor(Object entity, Object identifier, SharedSessionContractImplementor session)
Description copied from interface:BytecodeEnhancementMetadata
Build and inject an interceptor instance into the enhanced entity.- Specified by:
injectInterceptor
in interfaceBytecodeEnhancementMetadata
- Parameters:
entity
- The entity into which built interceptor should be injectedsession
- The session to which the entity instance belongs.- Returns:
- The built and injected interceptor
-
injectEnhancedEntityAsProxyInterceptor
public void injectEnhancedEntityAsProxyInterceptor(Object entity, EntityKey entityKey, SharedSessionContractImplementor session)
- Specified by:
injectEnhancedEntityAsProxyInterceptor
in interfaceBytecodeEnhancementMetadata
-
injectInterceptor
public void injectInterceptor(Object entity, PersistentAttributeInterceptor interceptor, SharedSessionContractImplementor session)
- Specified by:
injectInterceptor
in interfaceBytecodeEnhancementMetadata
-
extractLazyInterceptor
public @Nullable BytecodeLazyAttributeInterceptor extractLazyInterceptor(Object entity) throws NotInstrumentedException
- Specified by:
extractLazyInterceptor
in interfaceBytecodeEnhancementMetadata
- Throws:
NotInstrumentedException
-
-