java.io
Class ObjectStreamField

java.lang.Object
  |
  +--java.io.ObjectStreamField

public class ObjectStreamField
extends Object
implements Comparable

A description of a Serializable field from a Serializable class. An array of ObjectStreamFields is used to declare the Serializable fields of a class.

See Also:
ObjectStreamClass

Field Summary
private  int bufoffset
           
private  Class clazz
           
private  java.lang.reflect.Field field
           
private  String name
           
private static String OBJECT_TYPESTRING
           
private  char type
           
private  String typeString
           
 
Constructor Summary
(package private) ObjectStreamField()
           
(package private) ObjectStreamField(java.lang.reflect.Field field)
          Create a default Serializable field for field.
private ObjectStreamField(String name, boolean isPrimitive)
          SearchKey constructor.
(package private) ObjectStreamField(String n, char t, java.lang.reflect.Field f, String ts)
          Create an ObjectStreamField containing a reflected Field.
  ObjectStreamField(String n, Class clazz)
          Create a Serializable field with the specified type.
 
Method Summary
 int compareTo(Object o)
          Compare this field with another ObjectStreamField.
(package private) static ObjectStreamField constructSearchKey(String fieldName, Class fieldType)
           
(package private)  java.lang.reflect.Field getField()
           
 String getName()
          Get the name of this field.
 int getOffset()
          Offset of field within instance data.
 Class getType()
          Get the type of the field.
 char getTypeCode()
          Returns character encoding of field type.
 String getTypeString()
          Return the JVM type signature.
 boolean isPrimitive()
          Return true if this field has a primitive type.
(package private)  void setField(java.lang.reflect.Field field)
           
protected  void setOffset(int offset)
          Offset within instance data.
(package private)  void setSearchKeyTypeString(boolean isPrimitive)
           
 String toString()
          Return a string that describes this field.
(package private)  boolean typeEquals(ObjectStreamField other)
          Compare the type of this ObjectStreamField with other.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

name

private String name

type

private char type

field

private java.lang.reflect.Field field

typeString

private String typeString

bufoffset

private int bufoffset

clazz

private Class clazz

OBJECT_TYPESTRING

private static final String OBJECT_TYPESTRING
Constructor Detail

ObjectStreamField

public ObjectStreamField(String n,
                         Class clazz)
Create a Serializable field with the specified type. This field should be documented with a serialField tag.

ObjectStreamField

ObjectStreamField(java.lang.reflect.Field field)
Create a default Serializable field for field.

ObjectStreamField

ObjectStreamField(String n,
                  char t,
                  java.lang.reflect.Field f,
                  String ts)
Create an ObjectStreamField containing a reflected Field.

ObjectStreamField

private ObjectStreamField(String name,
                          boolean isPrimitive)
SearchKey constructor.
See Also:
compareTo(Object)

ObjectStreamField

ObjectStreamField()
Method Detail

getName

public String getName()
Get the name of this field.

getType

public Class getType()
Get the type of the field.

getTypeCode

public char getTypeCode()
Returns character encoding of field type. The encoding is as follows:
 B            byte
 C            char
 D            double
 F            float
 I            int
 J            long
 L            class or interface
 S            short
 Z            boolean
 [            array
 

getTypeString

public String getTypeString()
Return the JVM type signature.

getOffset

public int getOffset()
Offset of field within instance data.

setOffset

protected void setOffset(int offset)
Offset within instance data.

isPrimitive

public boolean isPrimitive()
Return true if this field has a primitive type.

compareTo

public int compareTo(Object o)
Compare this field with another ObjectStreamField. Return -1 if this is smaller, 0 if equal, 1 if greater. Types that are primitives are "smaller" than object types. If equal, the field names are compared.
Specified by:
compareTo in interface Comparable

toString

public String toString()
Return a string that describes this field.
Overrides:
toString in class Object

typeEquals

boolean typeEquals(ObjectStreamField other)
Compare the type of this ObjectStreamField with other.

getField

java.lang.reflect.Field getField()

setField

void setField(java.lang.reflect.Field field)

constructSearchKey

static ObjectStreamField constructSearchKey(String fieldName,
                                            Class fieldType)
See Also:
compareTo(Object)

setSearchKeyTypeString

void setSearchKeyTypeString(boolean isPrimitive)