Spec-Zone .ru
спецификации, руководства, описания, API
JavaTM 2 Platform
Std. Ed. v1.3.1

java.io
Class ObjectStreamField

java.lang.Object
  |
  +--java.io.ObjectStreamField
All Implemented Interfaces:
Comparable

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.

Since:
1.2
See Also:
ObjectStreamClass

Constructor Summary
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.
 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.
protected  void setOffset(int offset)
          Offset within instance data.
 String toString()
          Return a string that describes this field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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.
Parameters:
n - the name of the serializable field
clazz - the Class object of the serializable field
Method Detail

getName

public String getName()
Get the name of this field.
Returns:
a String representing the name of the serializable field

getType

public Class getType()
Get the type of the field.
Returns:
the Class object of the serializable 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
 
Returns:
the typecode of the serializable field

getTypeString

public String getTypeString()
Return the JVM type signature.
Returns:
null if this field has a primitive type.

getOffset

public int getOffset()
Offset of field within instance data.
Returns:
the offset of this field
See Also:
setOffset(int)

setOffset

protected void setOffset(int offset)
Offset within instance data.
Parameters:
offset - the offset of the field
See Also:
getOffset()

isPrimitive

public boolean isPrimitive()
Return true if this field has a primitive type.
Returns:
true if and only if this field corresponds to 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
Following copied from interface: java.lang.Comparable
Parameters:
o - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
ClassCastException - if the specified object's type prevents it from being compared to this Object.

toString

public String toString()
Return a string that describes this field.
Overrides:
toString in class Object
Following copied from class: java.lang.Object
Returns:
a string representation of the object.

JavaTM 2 Platform
Std. Ed. v1.3.1

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.

free hit counter