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

java.io
Class ObjectStreamClass

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

public class ObjectStreamClass
extends Object
implements Serializable

Serialization's descriptor for classes. It contains the name and serialVersionUID of the class.
The ObjectStreamClass for a specific class loaded in this Java VM can be found/created using the lookup method.

The algorithm to compute the SerialVersionUID is described in Object Serialization Specification, Section 4.4, Stream Unique Identifiers.

Since:
JDK1.1
See Also:
ObjectStreamField, Object Serialization Specification, Section 4, Class Descriptors, Serialized Form

Field Summary
static ObjectStreamField[] NO_FIELDS
          Set serialPersistentFields of a Serializable class to this value to denote that the class has no Serializable fields.
 
Method Summary
 Class forClass()
          Return the class in the local VM that this version is mapped to.
 ObjectStreamField getField(String name)
          Get the field of this class by name.
 ObjectStreamField[] getFields()
          Return an array of the fields of this serializable class.
 String getName()
          The name of the class described by this descriptor.
 long getSerialVersionUID()
          Return the serialVersionUID for this class.
static ObjectStreamClass lookup(Class cl)
          Find the descriptor for a class that can be serialized.
 String toString()
          Return a string describing this ObjectStreamClass.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_FIELDS

public static final ObjectStreamField[] NO_FIELDS
Set serialPersistentFields of a Serializable class to this value to denote that the class has no Serializable fields.
Method Detail

lookup

public static ObjectStreamClass lookup(Class cl)
Find the descriptor for a class that can be serialized. Creates an ObjectStreamClass instance if one does not exist yet for class. Null is returned if the specified class does not implement java.io.Serializable or java.io.Externalizable.

getName

public String getName()
The name of the class described by this descriptor.

getSerialVersionUID

public long getSerialVersionUID()
Return the serialVersionUID for this class. The serialVersionUID defines a set of classes all with the same name that have evolved from a common root class and agree to be serialized and deserialized using a common format. NonSerializable classes have a serialVersionUID of 0L.

forClass

public Class forClass()
Return the class in the local VM that this version is mapped to. Null is returned if there is no corresponding local class.

getFields

public ObjectStreamField[] getFields()
Return an array of the fields of this serializable class.
Returns:
an array containing an element for each persistent field of this class. Returns an array of length zero if there are no fields.
Since:
JDK1.2

getField

public ObjectStreamField getField(String name)
Get the field of this class by name.
Returns:
The ObjectStreamField object of the named field or null if there is no such named field.

toString

public String toString()
Return a string describing this ObjectStreamClass.
Overrides:
toString in class Object
Tags copied from class: Object
Returns:
a string representation of the object.

JavaTM 2 Platform
Standard Edition

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