fr.umlv.corosol.component.proxy.impl
Class JFieldHelper

java.lang.Object
  extended by fr.umlv.corosol.component.proxy.impl.JFieldHelper
All Implemented Interfaces:
JObject

public class JFieldHelper
extends java.lang.Object
implements JObject

This class is used by the DefaultJProxyFactory object when this later dynamically creates a proxy Class object for an object allocated in the Corosol heap. In those proxy Class object, all the getfield and putfield byte code instructions are replaced by ainvokestatic instruction calling a static method of the JFieldHelper class :

depending the type of the designed field.

Author:
Christophe Deleray

Constructor Summary
JFieldHelper()
           
 
Method Summary
static java.lang.Object get(JProxy proxy, int index)
          Returns the object field value of the class instance allocated in the Corosol JVM heap and nested by the specified proxy object.
static boolean getBoolean(JProxy proxy, int index)
          Returns the boolean field value of the class instance allocated in the Corosol JVM heap and nested by the specified proxy object.
static byte getByte(JProxy proxy, int index)
          Returns the byte field value of the class instance allocated in the Corosol JVM heap and nested by the specified proxy object.
static char getChar(JProxy proxy, int index)
          Returns the char field value of the class instance allocated in the Corosol JVM heap and nested by the specified proxy object.
static double getDouble(JProxy proxy, int index)
          Returns the double field value of the class instance allocated in the Corosol JVM heap and nested by the specified proxy object.
static float getFloat(JProxy proxy, int index)
          Returns the float field value of the class instance allocated in the Corosol JVM heap and nested by the specified proxy object.
static int getInt(JProxy proxy, int index)
          Returns the int field value of the class instance allocated in the Corosol JVM heap and nested by the specified proxy object.
static long getLong(JProxy proxy, int index)
          Returns the long field value of the class instance allocated in the Corosol JVM heap and nested by the specified proxy object.
static short getShort(JProxy proxy, int index)
          Returns the short field value of the class instance allocated in the Corosol JVM heap and nested by the specified proxy object.
static void set(JProxy proxy, java.lang.Object obj, int index)
          Sets the object field of the class instance nested by the specified proxy object and allocated in the Corosol JVM heap with the reference of o.
static void setBoolean(JProxy proxy, boolean value, int index)
          Sets the field of the class instance nested by the specified proxy object and allocated in the Corosol JVM heap with the specified boolean value.
static void setByte(JProxy proxy, byte value, int index)
          Sets the field of the class instance nested by the specified proxy object and allocated in the Corosol JVM heap with the specified byte value.
static void setChar(JProxy proxy, char value, int index)
          Sets the field of the class instance nested by the specified proxy object and allocated in the Corosol JVM heap with the specified char value.
static void setDouble(JProxy proxy, double value, int index)
          Sets the field of the class instance nested by the specified proxy object and allocated in the Corosol JVM heap with the specified double value.
static void setFloat(JProxy proxy, float value, int index)
          Sets the field of the class instance nested by the specified proxy object and allocated in the Corosol JVM heap with the specified float value.
static void setInt(JProxy proxy, int value, int index)
          Sets the field of the class instance nested by the specified proxy object and allocated in the Corosol JVM heap with the specified int value.
static void setLong(JProxy proxy, long value, int index)
          Sets the field of the class instance nested by the specified proxy object and allocated in the Corosol JVM heap with the specified long value.
static void setShort(JProxy proxy, short value, int index)
          Sets the field of the class instance nested by the specified proxy object and allocated in the Corosol JVM heap with the specified short value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JFieldHelper

public JFieldHelper()
Method Detail

get

public static java.lang.Object get(JProxy proxy,
                                   int index)
Returns the object field value of the class instance allocated in the Corosol JVM heap and nested by the specified proxy object. This field is designed by a specified index in the constant pool of the class of this instance. This index is the operand of the getfield instruction that we replaced. This field is resolved if necessary and its value is returned.

Parameters:
proxy - a proxy object nesting a class instance allocated in the Corosol JVM heap
index - the getfield instruction operand
Returns:
the specified object field value

getInt

public static int getInt(JProxy proxy,
                         int index)
Returns the int field value of the class instance allocated in the Corosol JVM heap and nested by the specified proxy object. This field is designed by a specified index in the constant pool of the class of this instance. This index is the operand of the getfield instruction that we replaced. This field is resolved if necessary and its value is returned as an int value.

Parameters:
proxy - a proxy object nesting a class instance allocated in the Corosol JVM heap
index - the getfield instruction operand
Returns:
the specified int field value

getLong

public static long getLong(JProxy proxy,
                           int index)
Returns the long field value of the class instance allocated in the Corosol JVM heap and nested by the specified proxy object. This field is designed by a specified index in the constant pool of the class of this instance. This index is the operand of the getfield instruction that we replaced. This field is resolved if necessary and its value is returned as an long value.

Parameters:
proxy - a proxy object nesting a class instance allocated in the Corosol JVM heap
index - the getfield instruction operand
Returns:
the specified long field value

getFloat

public static float getFloat(JProxy proxy,
                             int index)
Returns the float field value of the class instance allocated in the Corosol JVM heap and nested by the specified proxy object. This field is designed by a specified index in the constant pool of the class of this instance. This index is the operand of the getfield instruction that we replaced. This field is resolved if necessary and its value is returned as an float value.

Parameters:
proxy - a proxy object nesting a class instance allocated in the Corosol JVM heap
index - the getfield instruction operand
Returns:
the specified float field value

getDouble

public static double getDouble(JProxy proxy,
                               int index)
Returns the double field value of the class instance allocated in the Corosol JVM heap and nested by the specified proxy object. This field is designed by a specified index in the constant pool of the class of this instance. This index is the operand of the getfield instruction that we replaced. This field is resolved if necessary and its value is returned as an double value.

Parameters:
proxy - a proxy object nesting a class instance allocated in the Corosol JVM heap
index - the getfield instruction operand
Returns:
the specified double field value

getBoolean

public static boolean getBoolean(JProxy proxy,
                                 int index)
Returns the boolean field value of the class instance allocated in the Corosol JVM heap and nested by the specified proxy object. This field is designed by a specified index in the constant pool of the class of this instance. This index is the operand of the getfield instruction that we replaced. This field is resolved if necessary and its value is returned as an boolean value.

Parameters:
proxy - a proxy object nesting a class instance allocated in the Corosol JVM heap
index - the getfield instruction operand
Returns:
the specified boolean field value

getByte

public static byte getByte(JProxy proxy,
                           int index)
Returns the byte field value of the class instance allocated in the Corosol JVM heap and nested by the specified proxy object. This field is designed by a specified index in the constant pool of the class of this instance. This index is the operand of the getfield instruction that we replaced. This field is resolved if necessary and its value is returned as an byte value.

Parameters:
proxy - a proxy object nesting a class instance allocated in the Corosol JVM heap
index - the getfield instruction operand
Returns:
the specified byte field value

getChar

public static char getChar(JProxy proxy,
                           int index)
Returns the char field value of the class instance allocated in the Corosol JVM heap and nested by the specified proxy object. This field is designed by a specified index in the constant pool of the class of this instance. This index is the operand of the getfield instruction that we replaced. This field is resolved if necessary and its value is returned as an char value.

Parameters:
proxy - a proxy object nesting a class instance allocated in the Corosol JVM heap
index - the getfield instruction operand
Returns:
the specified char field value

getShort

public static short getShort(JProxy proxy,
                             int index)
Returns the short field value of the class instance allocated in the Corosol JVM heap and nested by the specified proxy object. This field is designed by a specified index in the constant pool of the class of this instance. This index is the operand of the getfield instruction that we replaced. This field is resolved if necessary and its value is returned as an short value.

Parameters:
proxy - a proxy object nesting a class instance allocated in the Corosol JVM heap
index - the getfield instruction operand
Returns:
the specified short field value

set

public static void set(JProxy proxy,
                       java.lang.Object obj,
                       int index)
Sets the object field of the class instance nested by the specified proxy object and allocated in the Corosol JVM heap with the reference of o. This field is designed by a specified index in the constant pool of the class of this instance. This index is the operand of the putfield instruction that we replaced. This field is resolved if necessary.

Parameters:
proxy - a proxy object nesting a class instance allocated in the Corosol JVM heap
obj - the new value of the resolved field
index - the putfield instruction operand

setInt

public static void setInt(JProxy proxy,
                          int value,
                          int index)
Sets the field of the class instance nested by the specified proxy object and allocated in the Corosol JVM heap with the specified int value. This field is designed by a specified index in the constant pool of the class of this instance. This index is the operand of the putfield instruction that we replaced. This field is resolved if necessary.

Parameters:
proxy - a proxy object nesting a class instance allocated in the Corosol JVM heap
value - the new int value of the resolved field
index - the putfield instruction operand

setLong

public static void setLong(JProxy proxy,
                           long value,
                           int index)
Sets the field of the class instance nested by the specified proxy object and allocated in the Corosol JVM heap with the specified long value. This field is designed by a specified index in the constant pool of the class of this instance. This index is the operand of the putfield instruction that we replaced. This field is resolved if necessary.

Parameters:
proxy - a proxy object nesting a class instance allocated in the Corosol JVM heap
value - the new long value of the resolved field
index - the putfield instruction operand

setFloat

public static void setFloat(JProxy proxy,
                            float value,
                            int index)
Sets the field of the class instance nested by the specified proxy object and allocated in the Corosol JVM heap with the specified float value. This field is designed by a specified index in the constant pool of the class of this instance. This index is the operand of the putfield instruction that we replaced. This field is resolved if necessary.

Parameters:
proxy - a proxy object nesting a class instance allocated in the Corosol JVM heap
value - the new float value of the resolved field
index - the putfield instruction operand

setDouble

public static void setDouble(JProxy proxy,
                             double value,
                             int index)
Sets the field of the class instance nested by the specified proxy object and allocated in the Corosol JVM heap with the specified double value. This field is designed by a specified index in the constant pool of the class of this instance. This index is the operand of the putfield instruction that we replaced. This field is resolved if necessary.

Parameters:
proxy - a proxy object nesting a class instance allocated in the Corosol JVM heap
value - the new double value of the resolved field
index - the putfield instruction operand

setBoolean

public static void setBoolean(JProxy proxy,
                              boolean value,
                              int index)
Sets the field of the class instance nested by the specified proxy object and allocated in the Corosol JVM heap with the specified boolean value. This field is designed by a specified index in the constant pool of the class of this instance. This index is the operand of the putfield instruction that we replaced. This field is resolved if necessary.

Parameters:
proxy - a proxy object nesting a class instance allocated in the Corosol JVM heap
value - the new boolean value of the resolved field
index - the putfield instruction operand

setByte

public static void setByte(JProxy proxy,
                           byte value,
                           int index)
Sets the field of the class instance nested by the specified proxy object and allocated in the Corosol JVM heap with the specified byte value. This field is designed by a specified index in the constant pool of the class of this instance. This index is the operand of the putfield instruction that we replaced. This field is resolved if necessary.

Parameters:
proxy - a proxy object nesting a class instance allocated in the Corosol JVM heap
value - the new byte value of the resolved field
index - the putfield instruction operand

setChar

public static void setChar(JProxy proxy,
                           char value,
                           int index)
Sets the field of the class instance nested by the specified proxy object and allocated in the Corosol JVM heap with the specified char value. This field is designed by a specified index in the constant pool of the class of this instance. This index is the operand of the putfield instruction that we replaced. This field is resolved if necessary.

Parameters:
proxy - a proxy object nesting a class instance allocated in the Corosol JVM heap
value - the new char value of the resolved field
index - the putfield instruction operand

setShort

public static void setShort(JProxy proxy,
                            short value,
                            int index)
Sets the field of the class instance nested by the specified proxy object and allocated in the Corosol JVM heap with the specified short value. This field is designed by a specified index in the constant pool of the class of this instance. This index is the operand of the putfield instruction that we replaced. This field is resolved if necessary.

Parameters:
proxy - a proxy object nesting a class instance allocated in the Corosol JVM heap
value - the new short value of the resolved field
index - the putfield instruction operand