Class ObjectStreamClass
java.lang.Object
java.io.ObjectStreamClass
- All Implemented Interfaces:
- 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 Java Object Serialization Specification, Section 4.6, "Stream Unique Identifiers".
- Since:
- 1.1
- External Specifications
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final ObjectStreamField[]serialPersistentFields value indicating no serializable fields
- 
Method SummaryModifier and TypeMethodDescriptionClass<?> forClass()Return the class in the local VM that this version is mapped to.Get the field of this class by name.Return an array of the fields of this serializable class.getName()Returns the name of the class described by this descriptor.longReturn the serialVersionUID for this class.static ObjectStreamClassFind the descriptor for a class that can be serialized.static ObjectStreamClassReturns the descriptor for any class, regardless of whether it implementsSerializable.toString()Return a string describing this ObjectStreamClass.
- 
Field Details- 
NO_FIELDSserialPersistentFields value indicating no serializable fields
 
- 
- 
Method Details- 
lookupFind 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.- Parameters:
- cl- class for which to get the descriptor
- Returns:
- the class descriptor for the specified class
 
- 
lookupAnyReturns the descriptor for any class, regardless of whether it implementsSerializable.- Parameters:
- cl- class for which to get the descriptor
- Returns:
- the class descriptor for the specified class
- Since:
- 1.6
 
- 
getNameReturns the name of the class described by this descriptor. This method returns the name of the class in the format that is used by theClass.getName()method.- Returns:
- a string representing the name of the class
 
- 
getSerialVersionUIDpublic 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.- Returns:
- the SUID of the class described by this descriptor
 
- 
forClassReturn the class in the local VM that this version is mapped to. Null is returned if there is no corresponding local class.- Returns:
- the Classinstance that this descriptor represents
 
- 
getFieldsReturn 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:
- 1.2
 
- 
getFieldGet the field of this class by name.- Parameters:
- name- the name of the data field to look for
- Returns:
- The ObjectStreamField object of the named field or null if there is no such named field.
 
- 
toString
 
-