fr.umlv.corosol.component.impl
Class DefaultJClassInstance

java.lang.Object
  extended by fr.umlv.corosol.component.impl.DefaultJClassInstance
All Implemented Interfaces:
JAllocatable, JClassInstance, JHeapObject, JObject
Direct Known Subclasses:
StringInstance

public class DefaultJClassInstance
extends java.lang.Object
implements JClassInstance

This is the default implementation of the DefaultJClassInstance interface.

Author:
Christophe Deleray

Constructor Summary
DefaultJClassInstance()
          Creates a new DefaultJClassInstance.
 
Method Summary
 boolean getBoolean(JField field)
          Returns the boolean value of the specified field.
 byte getByte(JField field)
          Returns the byte value of the specified field.
 char getChar(JField field)
          Returns the char value of the specified field.
 double getDouble(JField field)
          Returns the double value of the specified field.
 float getFloat(JField field)
          Returns the float value of the specified field.
 int getInt(JField field)
          Returns the int value of the specified field.
 long getLong(JField field)
          Returns the long value of the specified field.
 java.lang.Object getNativeObject()
          Returns a proxy of the class instance represented by this DefaultJClassInstance object.
 JHeapObject getObject(JField field)
          Returns the object corresponding to the specified field.
 int getPosition()
          Returns the position of the first byte of the memory allocated for the object representing by this JClassInstance object into the Corosol heap memory.
 short getShort(JField field)
          Returns the short value of the specified field.
 int getSize()
          Returns the size in bytes of this object into the Corosol memory heap.
 JClass getType()
          Returns the dynamic type of the class instance represented by this DefaultJClassInstance object.
 boolean isNative()
          Determines if the class instance represented by this DefaultJClassInstance object is allocated into the underlaying JVM heap and not into the Corosol JVM heap.
 void setBoolean(JField field, boolean value)
          Sets the specified field with the specified boolean value.
 void setByte(JField field, byte value)
          Sets the specified field with the specified byte value.
 void setChar(JField field, char value)
          Sets the specified field with the specified char value.
 void setDouble(JField field, double value)
          Sets the specified field with the specified double value.
 void setFloat(JField field, float value)
          Sets the specified field with the specified float value.
 void setInt(JField field, int value)
          Sets the specified field with the specified int value.
 void setLayout(JClassLayout layout)
          Sets the layout of the object representing by this JClassInstance object.
 void setLong(JField field, long value)
          Sets the specified field with the specified long value.
 void setObject(JField field, JHeapObject value)
          Sets the specified field with the reference of the specified object.
 void setPosition(int index)
          Sets the position of the first byte of the memory allocated for the object representing by this JClassInstance object into the Corosol heap memory.
 void setShort(JField field, short value)
          Sets the specified field with the specified short value.
 java.lang.String toString()
          Returns a String representation of the class instance represented by this DefaultJClassInstance object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultJClassInstance

public DefaultJClassInstance()
Creates a new DefaultJClassInstance.

Method Detail

setLayout

public void setLayout(JClassLayout layout)
Sets the layout of the object representing by this JClassInstance object. layout describes the relative position of each field of this object into the memory allocated for it.

Specified by:
setLayout in interface JClassInstance
Parameters:
layout - the layout describing the object class field positions

getPosition

public int getPosition()
Returns the position of the first byte of the memory allocated for the object representing by this JClassInstance object into the Corosol heap memory.

Specified by:
getPosition in interface JAllocatable
Returns:
the position of the first byte of the memory allocated for this object into the Corosol heap memory

setPosition

public void setPosition(int index)
Sets the position of the first byte of the memory allocated for the object representing by this JClassInstance object into the Corosol heap memory.

Specified by:
setPosition in interface JAllocatable
Parameters:
index - the position of the first byte of the memory allocated for this object into the Corosol heap memory.

getSize

public int getSize()
Returns the size in bytes of this object into the Corosol memory heap.

Specified by:
getSize in interface JAllocatable

getByte

public byte getByte(JField field)
Returns the byte value of the specified field.

Specified by:
getByte in interface JClassInstance
Parameters:
field - a field
Returns:
the field value

getBoolean

public boolean getBoolean(JField field)
Returns the boolean value of the specified field.

Specified by:
getBoolean in interface JClassInstance
Parameters:
field - a field
Returns:
the field value

getChar

public char getChar(JField field)
Returns the char value of the specified field.

Specified by:
getChar in interface JClassInstance
Parameters:
field - a field
Returns:
the field value

getShort

public short getShort(JField field)
Returns the short value of the specified field.

Specified by:
getShort in interface JClassInstance
Parameters:
field - a field
Returns:
the field value

getInt

public int getInt(JField field)
Returns the int value of the specified field.

Specified by:
getInt in interface JClassInstance
Parameters:
field - a field
Returns:
the field value

getFloat

public float getFloat(JField field)
Returns the float value of the specified field.

Specified by:
getFloat in interface JClassInstance
Parameters:
field - a field
Returns:
the field value

getLong

public long getLong(JField field)
Returns the long value of the specified field.

Specified by:
getLong in interface JClassInstance
Parameters:
field - a field
Returns:
the field value

getDouble

public double getDouble(JField field)
Returns the double value of the specified field.

Specified by:
getDouble in interface JClassInstance
Parameters:
field - a field
Returns:
the field value

getObject

public JHeapObject getObject(JField field)
Returns the object corresponding to the specified field.

Specified by:
getObject in interface JClassInstance
Parameters:
field - a field
Returns:
the field value

setByte

public void setByte(JField field,
                    byte value)
Sets the specified field with the specified byte value.

Specified by:
setByte in interface JClassInstance
Parameters:
field - a field
value - a byte value

setBoolean

public void setBoolean(JField field,
                       boolean value)
Sets the specified field with the specified boolean value.

Specified by:
setBoolean in interface JClassInstance
Parameters:
field - a field
value - a boolean value

setChar

public void setChar(JField field,
                    char value)
Sets the specified field with the specified char value.

Specified by:
setChar in interface JClassInstance
Parameters:
field - a field
value - a char value

setShort

public void setShort(JField field,
                     short value)
Sets the specified field with the specified short value.

Specified by:
setShort in interface JClassInstance
Parameters:
field - a field
value - a short value

setInt

public void setInt(JField field,
                   int value)
Sets the specified field with the specified int value.

Specified by:
setInt in interface JClassInstance
Parameters:
field - a field
value - a int value

setFloat

public void setFloat(JField field,
                     float value)
Sets the specified field with the specified float value.

Specified by:
setFloat in interface JClassInstance
Parameters:
field - a field
value - a float value

setLong

public void setLong(JField field,
                    long value)
Sets the specified field with the specified long value.

Specified by:
setLong in interface JClassInstance
Parameters:
field - a field
value - a long value

setDouble

public void setDouble(JField field,
                      double value)
Sets the specified field with the specified double value.

Specified by:
setDouble in interface JClassInstance
Parameters:
field - a field
value - a double value

setObject

public void setObject(JField field,
                      JHeapObject value)
Sets the specified field with the reference of the specified object.

Specified by:
setObject in interface JClassInstance
Parameters:
field - a field
value - an object

getNativeObject

public java.lang.Object getNativeObject()
Returns a proxy of the class instance represented by this DefaultJClassInstance object.

Specified by:
getNativeObject in interface JHeapObject

getType

public JClass getType()
Returns the dynamic type of the class instance represented by this DefaultJClassInstance object.

Specified by:
getType in interface JHeapObject
Returns:
the JClass object representing the dynamic type of this class instance

isNative

public boolean isNative()
Determines if the class instance represented by this DefaultJClassInstance object is allocated into the underlaying JVM heap and not into the Corosol JVM heap.

Specified by:
isNative in interface JHeapObject
Returns:
true if this class instance is allocated into the underlaying JVM heap; false otherwise.

toString

public java.lang.String toString()
Returns a String representation of the class instance represented by this DefaultJClassInstance object.

Overrides:
toString in class java.lang.Object