org.hibernate.intercept
Class FieldInterceptor

java.lang.Object
  extended byorg.hibernate.intercept.FieldInterceptor
All Implemented Interfaces:
net.sf.cglib.transform.impl.InterceptFieldCallback, Serializable

public final class FieldInterceptor
extends Object
implements net.sf.cglib.transform.impl.InterceptFieldCallback, Serializable

A field-level interceptor that initializes lazily fetched properties. This interceptor can be attached to classes instrumented by CGLIB. Note that this implementation assumes that the instance variable name is the same as the name of the persistent property that must be loaded.

Author:
Gavin King
See Also:
Serialized Form

Method Summary
 void clearDirty()
           
static void clearDirty(Object entity)
           
 void dirty()
           
static FieldInterceptor getFieldInterceptor(Object entity)
           
static boolean hasInterceptor(Object entity)
           
static FieldInterceptor initFieldInterceptor(Object entity, String entityName, SessionImplementor session, Set lazyProps)
           
 boolean isDirty()
           
 boolean isInitialized()
           
 boolean isInitialized(String field)
           
 boolean readBoolean(Object target, String name, boolean oldValue)
           
 byte readByte(Object target, String name, byte oldValue)
           
 char readChar(Object target, String name, char oldValue)
           
 double readDouble(Object target, String name, double oldValue)
           
 float readFloat(Object target, String name, float oldValue)
           
 int readInt(Object target, String name, int oldValue)
           
 long readLong(Object target, String name, long oldValue)
           
 Object readObject(Object target, String name, Object oldValue)
           
 short readShort(Object target, String name, short oldValue)
           
 void setSession(SessionImplementor session)
           
 String toString()
           
 boolean writeBoolean(Object target, String name, boolean oldValue, boolean newValue)
           
 byte writeByte(Object target, String name, byte oldValue, byte newValue)
           
 char writeChar(Object target, String name, char oldValue, char newValue)
           
 double writeDouble(Object target, String name, double oldValue, double newValue)
           
 float writeFloat(Object target, String name, float oldValue, float newValue)
           
 int writeInt(Object target, String name, int oldValue, int newValue)
           
 long writeLong(Object target, String name, long oldValue, long newValue)
           
 Object writeObject(Object target, String name, Object oldValue, Object newValue)
           
 short writeShort(Object target, String name, short oldValue, short newValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

setSession

public void setSession(SessionImplementor session)

isInitialized

public boolean isInitialized()

isInitialized

public boolean isInitialized(String field)

dirty

public void dirty()

isDirty

public boolean isDirty()

clearDirty

public void clearDirty()

readBoolean

public boolean readBoolean(Object target,
                           String name,
                           boolean oldValue)
Specified by:
readBoolean in interface net.sf.cglib.transform.impl.InterceptFieldCallback

readByte

public byte readByte(Object target,
                     String name,
                     byte oldValue)
Specified by:
readByte in interface net.sf.cglib.transform.impl.InterceptFieldCallback

readChar

public char readChar(Object target,
                     String name,
                     char oldValue)
Specified by:
readChar in interface net.sf.cglib.transform.impl.InterceptFieldCallback

readDouble

public double readDouble(Object target,
                         String name,
                         double oldValue)
Specified by:
readDouble in interface net.sf.cglib.transform.impl.InterceptFieldCallback

readFloat

public float readFloat(Object target,
                       String name,
                       float oldValue)
Specified by:
readFloat in interface net.sf.cglib.transform.impl.InterceptFieldCallback

readInt

public int readInt(Object target,
                   String name,
                   int oldValue)
Specified by:
readInt in interface net.sf.cglib.transform.impl.InterceptFieldCallback

readLong

public long readLong(Object target,
                     String name,
                     long oldValue)
Specified by:
readLong in interface net.sf.cglib.transform.impl.InterceptFieldCallback

readShort

public short readShort(Object target,
                       String name,
                       short oldValue)
Specified by:
readShort in interface net.sf.cglib.transform.impl.InterceptFieldCallback

readObject

public Object readObject(Object target,
                         String name,
                         Object oldValue)
Specified by:
readObject in interface net.sf.cglib.transform.impl.InterceptFieldCallback

writeBoolean

public boolean writeBoolean(Object target,
                            String name,
                            boolean oldValue,
                            boolean newValue)
Specified by:
writeBoolean in interface net.sf.cglib.transform.impl.InterceptFieldCallback

writeByte

public byte writeByte(Object target,
                      String name,
                      byte oldValue,
                      byte newValue)
Specified by:
writeByte in interface net.sf.cglib.transform.impl.InterceptFieldCallback

writeChar

public char writeChar(Object target,
                      String name,
                      char oldValue,
                      char newValue)
Specified by:
writeChar in interface net.sf.cglib.transform.impl.InterceptFieldCallback

writeDouble

public double writeDouble(Object target,
                          String name,
                          double oldValue,
                          double newValue)
Specified by:
writeDouble in interface net.sf.cglib.transform.impl.InterceptFieldCallback

writeFloat

public float writeFloat(Object target,
                        String name,
                        float oldValue,
                        float newValue)
Specified by:
writeFloat in interface net.sf.cglib.transform.impl.InterceptFieldCallback

writeInt

public int writeInt(Object target,
                    String name,
                    int oldValue,
                    int newValue)
Specified by:
writeInt in interface net.sf.cglib.transform.impl.InterceptFieldCallback

writeLong

public long writeLong(Object target,
                      String name,
                      long oldValue,
                      long newValue)
Specified by:
writeLong in interface net.sf.cglib.transform.impl.InterceptFieldCallback

writeShort

public short writeShort(Object target,
                        String name,
                        short oldValue,
                        short newValue)
Specified by:
writeShort in interface net.sf.cglib.transform.impl.InterceptFieldCallback

writeObject

public Object writeObject(Object target,
                          String name,
                          Object oldValue,
                          Object newValue)
Specified by:
writeObject in interface net.sf.cglib.transform.impl.InterceptFieldCallback

toString

public String toString()

clearDirty

public static void clearDirty(Object entity)

hasInterceptor

public static boolean hasInterceptor(Object entity)

getFieldInterceptor

public static FieldInterceptor getFieldInterceptor(Object entity)

initFieldInterceptor

public static FieldInterceptor initFieldInterceptor(Object entity,
                                                    String entityName,
                                                    SessionImplementor session,
                                                    Set lazyProps)