Class: java.io.ObjectStreamField

A description of a Serializable field from a Serializable class. An array of ObjectStreamFields is used to declare the Serializable fields of a class.
Authors:
@author Mike Warres
@author Roger Riggs
See:
@see java.io.ObjectStreamClass
Since:
@since 1.2

Inheritance

Superclass tree: Implements:

Methods

  • ObjectStreamFieldtop

    public ObjectStreamField(String name, Class<?> type)
    Create a Serializable field with the specified type. This field should be documented with a serialField tag.
    Parameters:
    @param name the name of the serializable field
    @param type the Class object of the serializable field
    Google Code Search
    Stack Overflow
  • ObjectStreamFieldtop

    public ObjectStreamField(String name, Class<?> type, boolean unshared)
    Creates an ObjectStreamField representing a serializable field with the given name and type. If unshared is false, values of the represented field are serialized and deserialized in the default manner--if the field is non-primitive, object values are serialized and deserialized as if they had been written and read by calls to writeObject and readObject. If unshared is true, values of the represented field are serialized and deserialized as if they had been written and read by calls to writeUnshared and readUnshared.
    Parameters:
    @param name field name
    @param type field type
    @param unshared if false, write/read field values in the same manner as writeObject/readObject; if true, write/read in the same manner as writeUnshared/readUnshared
    Since:
    @since 1.4
    Google Code Search
    Stack Overflow
  • compareTotop

    public int compareTo(Object obj)
    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.
    Return:
    @return a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
    Specified by:
    compareTo from Comparable<Object>
    Google Code Search
    Stack Overflow
  • getNametop

    public String getName()
    Get the name of this field.
    Return:
    @return a String representing the name of the serializable field
    Google Code Search
    Stack Overflow
  • getOffsettop

    public int getOffset()
    Offset of field within instance data.
    Return:
    @return the offset of this field
    See:
    @see java.io.ObjectStreamField.setOffset(int)
    Google Code Search
    Stack Overflow
  • getTypetop

    public Class<?> getType()
    Get the type of the field. If the type is non-primitive and this ObjectStreamField was obtained from a deserialized java.io.ObjectStreamClass instance, then Object.class is returned. Otherwise, the Class object for the type of the field is returned.
    Return:
    @return a Class object representing the type of the serializable field
    Google Code Search
    Stack Overflow
  • getTypeCodetop

    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
     
    Return:
    @return the typecode of the serializable field
    Google Code Search
    Stack Overflow
  • getTypeStringtop

    public String getTypeString()
    Return the JVM type signature.
    Return:
    @return null if this field has a primitive type.
    Google Code Search
    Stack Overflow
  • isPrimitivetop

    public boolean isPrimitive()
    Return true if this field has a primitive type.
    Return:
    @return true if and only if this field corresponds to a primitive type
    Google Code Search
    Stack Overflow
  • isUnsharedtop

    public boolean isUnshared()
    Returns boolean value indicating whether or not the serializable field represented by this ObjectStreamField instance is unshared.
    Since:
    @since 1.4
    Google Code Search
    Stack Overflow
  • setOffsettop

    protected void setOffset(int offset)
    Offset within instance data.
    Parameters:
    @param offset the offset of the field
    See:
    @see java.io.ObjectStreamField.getOffset()
    Google Code Search
    Stack Overflow
  • toStringtop

    public String toString()
    Return a string that describes this field.
    Return:
    @return a string representation of the object.
    Override hierarchy:
    toString from Object
    Google Code Search
    Stack Overflow