java.io
Class ObjectStreamClass.FieldReflector

java.lang.Object
  extended byjava.io.ObjectStreamClass.FieldReflector
Enclosing class:
ObjectStreamClass

private static class ObjectStreamClass.FieldReflector
extends Object

Class for setting and retrieving serializable field values in batch.


Field Summary
private  ObjectStreamField[] fields
          fields to operate on
private  long[] keys
          unsafe field keys
private  int numPrimFields
          number of primitive fields
private  int[] offsets
          field data offsets
private  char[] typeCodes
          field type codes
private  Class[] types
          field types
private static sun.misc.Unsafe unsafe
          handle for performing unsafe operations
 
Constructor Summary
(package private) ObjectStreamClass.FieldReflector(ObjectStreamField[] fields)
          Constructs FieldReflector capable of setting/getting values from the subset of fields whose ObjectStreamFields contain non-null reflective Field objects.
 
Method Summary
(package private)  ObjectStreamField[] getFields()
          Returns list of ObjectStreamFields representing fields operated on by this reflector.
(package private)  void getObjFieldValues(Object obj, Object[] vals)
          Fetches the serializable object field values of object obj and stores them in array vals starting at offset 0.
(package private)  void getPrimFieldValues(Object obj, byte[] buf)
          Fetches the serializable primitive field values of object obj and marshals them into byte array buf starting at offset 0.
(package private)  void setObjFieldValues(Object obj, Object[] vals)
          Sets the serializable object fields of object obj using values from array vals starting at offset 0.
(package private)  void setPrimFieldValues(Object obj, byte[] buf)
          Sets the serializable primitive fields of object obj using values unmarshalled from byte array buf starting at offset 0.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

unsafe

private static final sun.misc.Unsafe unsafe
handle for performing unsafe operations


fields

private final ObjectStreamField[] fields
fields to operate on


numPrimFields

private final int numPrimFields
number of primitive fields


keys

private final long[] keys
unsafe field keys


offsets

private final int[] offsets
field data offsets


typeCodes

private final char[] typeCodes
field type codes


types

private final Class[] types
field types

Constructor Detail

ObjectStreamClass.FieldReflector

ObjectStreamClass.FieldReflector(ObjectStreamField[] fields)
Constructs FieldReflector capable of setting/getting values from the subset of fields whose ObjectStreamFields contain non-null reflective Field objects. ObjectStreamFields with null Fields are treated as filler, for which get operations return default values and set operations discard given values.

Method Detail

getFields

ObjectStreamField[] getFields()
Returns list of ObjectStreamFields representing fields operated on by this reflector. The shared/unshared values and Field objects contained by ObjectStreamFields in the list reflect their bindings to locally defined serializable fields.


getPrimFieldValues

void getPrimFieldValues(Object obj,
                        byte[] buf)
Fetches the serializable primitive field values of object obj and marshals them into byte array buf starting at offset 0. The caller is responsible for ensuring that obj is of the proper type.


setPrimFieldValues

void setPrimFieldValues(Object obj,
                        byte[] buf)
Sets the serializable primitive fields of object obj using values unmarshalled from byte array buf starting at offset 0. The caller is responsible for ensuring that obj is of the proper type.


getObjFieldValues

void getObjFieldValues(Object obj,
                       Object[] vals)
Fetches the serializable object field values of object obj and stores them in array vals starting at offset 0. The caller is responsible for ensuring that obj is of the proper type.


setObjFieldValues

void setObjFieldValues(Object obj,
                       Object[] vals)
Sets the serializable object fields of object obj using values from array vals starting at offset 0. The caller is responsible for ensuring that obj is of the proper type; however, attempts to set a field with a value of the wrong type will trigger an appropriate ClassCastException.