Class NiceByteBuddyInterceptor

java.lang.Object
org.hibernate.proxy.AbstractLazyInitializer
org.hibernate.proxy.pojo.BasicLazyInitializer
org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor
ch.tocco.nice2.persist.core.impl.hibernate.proxy.NiceByteBuddyInterceptor
All Implemented Interfaces:
org.hibernate.proxy.LazyInitializer, org.hibernate.proxy.ProxyConfiguration.Interceptor

public class NiceByteBuddyInterceptor extends org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor
A custom LazyInitializer that is aware of the Entity interface. It only initializes the proxy if the entity data is required and prevents initialization of the proxy when methods like Entity.getModel() are called.
  • Field Summary

    Fields inherited from class org.hibernate.proxy.pojo.BasicLazyInitializer

    componentIdType, getIdentifierMethod, INVOKE_IMPLEMENTATION, overridesEquals, persistentClass, setIdentifierMethod
  • Constructor Summary

    Constructors
    Constructor
    Description
    NiceByteBuddyInterceptor(DataModel dataModel, Context context, String entityName, Class persistentClass, Class[] interfaces, Serializable id, Method getIdentifierMethod, Method setIdentifierMethod, org.hibernate.type.CompositeType componentIdType, org.hibernate.engine.spi.SharedSessionContractImplementor session, boolean overridesEquals)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    intercept(Object proxy, Method thisMethod, Object[] args)
     

    Methods inherited from class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor

    serializableProxy

    Methods inherited from class org.hibernate.proxy.pojo.BasicLazyInitializer

    getImplementationClass, getPersistentClass, invoke

    Methods inherited from class org.hibernate.proxy.AbstractLazyInitializer

    getEntityName, getIdentifier, getImplementation, getImplementation, getImplementationEntityName, getInternalIdentifier, getSession, getSessionFactoryName, getSessionFactoryUuid, getTarget, initialize, initializeWithoutLoadIfPossible, isAllowLoadOutsideTransaction, isConnectedToSession, isReadOnly, isReadOnlyBeforeAttachedToSession, isReadOnlySettingAvailable, isUninitialized, isUnwrap, permissiveInitialization, prepareForPossibleLoadingOutsideTransaction, setIdentifier, setImplementation, setReadOnly, setSession, setUnwrap, unsetSession

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • NiceByteBuddyInterceptor

      public NiceByteBuddyInterceptor(DataModel dataModel, Context context, String entityName, Class persistentClass, Class[] interfaces, Serializable id, Method getIdentifierMethod, Method setIdentifierMethod, org.hibernate.type.CompositeType componentIdType, org.hibernate.engine.spi.SharedSessionContractImplementor session, boolean overridesEquals)
  • Method Details

    • intercept

      public Object intercept(Object proxy, Method thisMethod, Object[] args) throws Throwable
      Specified by:
      intercept in interface org.hibernate.proxy.ProxyConfiguration.Interceptor
      Overrides:
      intercept in class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor
      Throws:
      Throwable