Build 1.0_r1(from source)

java.io
Class ObjectStreamClass

java.lang.Object
  extended by java.io.ObjectStreamClass
All Implemented Interfaces:
Serializable

public class ObjectStreamClass
extends Object
implements Serializable

Instances of ObjectStreamClass are used to describe classes of objects used by serialization. When objects are saved, information about all its superclasses is also saved by the use of descriptors, instances of ObjectStreamClass. These descriptors carry information about the class they represent, such as - The name of the class - SUID of the class - Field names and types

See Also:
ObjectOutputStream, ObjectInputStream, Class, Serialized Form

Field Summary
(package private) static Class<?> ARRAY_OF_FIELDS
           
(package private) static Class<?> CLASSCLASS
           
(package private) static Class<?>[] EMPTY_CONSTRUCTOR_PARAM_TYPES
           
static ObjectStreamField[] NO_FIELDS
          A value that indicates the class has no Serializable fields
(package private) static Class<ObjectStreamClass> OBJECTSTREAMCLASSCLASS
           
(package private) static Class<String> STRINGCLASS
           
(package private) static Class<?>[] UNSHARED_PARAM_TYPES
           
 
Constructor Summary
ObjectStreamClass()
          Constructs a new instance of this class.
 
Method Summary
(package private)  void buildFieldDescriptors(Field[] declaredFields)
          Builds the collection of field descriptors for the receiver
(package private)  ObjectStreamField[] fields()
          Returns the collection of field descriptors for the fields of the corresponding class
(package private) static Field fieldSerialPersistentFields(Class<?> cl)
          Return the java.lang.reflect.Field serialPersistentFields if class cl implements it.
 Class<?> forClass()
          Return the class (java.lang.Class) that the receiver represents
(package private) static String getConstructorSignature(Constructor<?> c)
          Return a String representing the signature for a Constructor c.
 ObjectStreamField getField(String name)
          Returns a given field by name.
 ObjectStreamField[] getFields()
          Returns the collection of field descriptors for the fields of the corresponding class
(package private)  byte getFlags()
          Returns the flags for this descriptor, where possible combined values are ObjectStreamConstants.SC_WRITE_METHOD ObjectStreamConstants.SC_SERIALIZABLE ObjectStreamConstants.SC_EXTERNALIZABLE
(package private)  ObjectStreamField[] getLoadFields()
          Returns the collection of field descriptors for the input fields of the corresponding class
(package private) static String getMethodSignature(Method m)
          Return a String representing the signature for a method m.
 String getName()
          Returns the name of the class represented by the receiver
(package private) static Method getPrivateReadObjectMethod(Class<?> cl)
          Return true if the given class cl implements private method readObject().
(package private) static Method getPrivateReadObjectNoDataMethod(Class<?> cl)
          Return true if the given class cl implements private method readObject().
(package private) static Method getPrivateWriteObjectMethod(Class<?> cl)
          Return true if the given class cl implements private method writeObject().
 long getSerialVersionUID()
          Returns the Serial Version User ID of the class represented by the receiver
(package private)  ObjectStreamClass getSuperclass()
          Returns the descriptor (ObjectStreamClass) of the superclass of the class represented by the receiver.
(package private) static boolean isExternalizable(Class<?> cl)
          Return true if instances of class cl are Externalizable, false otherwise.
(package private) static boolean isPrimitiveType(char typecode)
          Return true if the type code typecode describes a primitive type
(package private) static boolean isSerializable(Class<?> cl)
          Return true if instances of class cl are Serializable, false otherwise.
static ObjectStreamClass lookup(Class<?> cl)
          Return the descriptor (ObjectStreamClass) corresponding to the class cl.
(package private) static ObjectStreamClass lookupStreamClass(Class<?> cl)
          Return the descriptor (ObjectStreamClass) corresponding to the class cl.
(package private) static Method methodReadResolve(Class<?> cl)
          Return the java.lang.reflect.Method readResolve if class cl implements it.
(package private) static Method methodWriteReplace(Class<?> cl)
          Return the java.lang.reflect.Method writeReplace if class cl implements it.
(package private)  void setClass(Class<?> c)
          Set the class (java.lang.Class) that the receiver represents
(package private)  void setFields(ObjectStreamField[] f)
          Set the collection of field descriptors for the fields of the corresponding class
(package private)  void setFlags(byte b)
          Set the flags for this descriptor, where possible combined values are ObjectStreamConstants.SC_WRITE_METHOD ObjectStreamConstants.SC_SERIALIZABLE ObjectStreamConstants.SC_EXTERNALIZABLE
(package private)  void setLoadFields(ObjectStreamField[] f)
          Set the collection of field descriptors for the input fields of the corresponding class
(package private)  void setName(String newName)
          Set the name of the class represented by the receiver
(package private)  void setSerialVersionUID(long l)
          Set the Serial Version User ID of the class represented by the receiver
(package private)  void setSuperclass(ObjectStreamClass c)
          Set the descriptor for the superclass of the class described by the receiver
 String toString()
          Returns a string containing a concise, human-readable description of the receiver.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_CONSTRUCTOR_PARAM_TYPES

static final Class<?>[] EMPTY_CONSTRUCTOR_PARAM_TYPES

UNSHARED_PARAM_TYPES

static final Class<?>[] UNSHARED_PARAM_TYPES

NO_FIELDS

public static final ObjectStreamField[] NO_FIELDS
A value that indicates the class has no Serializable fields


ARRAY_OF_FIELDS

static final Class<?> ARRAY_OF_FIELDS

STRINGCLASS

static final Class<String> STRINGCLASS

CLASSCLASS

static final Class<?> CLASSCLASS

OBJECTSTREAMCLASSCLASS

static final Class<ObjectStreamClass> OBJECTSTREAMCLASSCLASS
Constructor Detail

ObjectStreamClass

ObjectStreamClass()
Constructs a new instance of this class.

Method Detail

buildFieldDescriptors

void buildFieldDescriptors(Field[] declaredFields)
Builds the collection of field descriptors for the receiver

Parameters:
declaredFields - collection of java.lang.reflect.Field for which to compute field descriptors

fieldSerialPersistentFields

static Field fieldSerialPersistentFields(Class<?> cl)
Return the java.lang.reflect.Field serialPersistentFields if class cl implements it. Return null otherwise.

Parameters:
cl - a java.lang.Class which to test
Returns:
java.lang.reflect.Field if the class has serialPersistentFields null if the class does not have serialPersistentFields

forClass

public Class<?> forClass()
Return the class (java.lang.Class) that the receiver represents

Returns:
null if there is no corresponding class for the receiver Class The loaded class corresponding to the receiver

getConstructorSignature

static String getConstructorSignature(Constructor<?> c)
Return a String representing the signature for a Constructor c.

Parameters:
c - a java.lang.reflect.Constructor for which to compute the signature
Returns:
the constructor's signature

getField

public ObjectStreamField getField(String name)
Returns a given field by name.

Parameters:
name - name of the desired field.
Returns:
a given field by name.

fields

ObjectStreamField[] fields()
Returns the collection of field descriptors for the fields of the corresponding class

Returns:
the receiver's collection of declared fields for the class it represents

getFields

public ObjectStreamField[] getFields()
Returns the collection of field descriptors for the fields of the corresponding class

Returns:
the receiver's collection of declared fields for the class it represents

getLoadFields

ObjectStreamField[] getLoadFields()
Returns the collection of field descriptors for the input fields of the corresponding class

Returns:
the receiver's collection of input fields for the class it represents

getFlags

byte getFlags()
Returns the flags for this descriptor, where possible combined values are ObjectStreamConstants.SC_WRITE_METHOD ObjectStreamConstants.SC_SERIALIZABLE ObjectStreamConstants.SC_EXTERNALIZABLE

Returns:
byte the receiver's flags for the class it represents

getMethodSignature

static String getMethodSignature(Method m)
Return a String representing the signature for a method m.

Parameters:
m - a java.lang.reflect.Method for which to compute the signature
Returns:
the method's signature

getName

public String getName()
Returns the name of the class represented by the receiver

Returns:
fully qualified name of the class the receiver represents

getSerialVersionUID

public long getSerialVersionUID()
Returns the Serial Version User ID of the class represented by the receiver

Returns:
SUID for the class represented by the receiver

getSuperclass

ObjectStreamClass getSuperclass()
Returns the descriptor (ObjectStreamClass) of the superclass of the class represented by the receiver.

Returns:
an ObjectStreamClass representing the superclass of the class represented by the receiver.

getPrivateReadObjectMethod

static Method getPrivateReadObjectMethod(Class<?> cl)
Return true if the given class cl implements private method readObject().

Parameters:
cl - a java.lang.Class which to test
Returns:
true if the class implements readObject false if the class does not implement readObject

getPrivateReadObjectNoDataMethod

static Method getPrivateReadObjectNoDataMethod(Class<?> cl)
Return true if the given class cl implements private method readObject().

Parameters:
cl - a java.lang.Class which to test
Returns:
true if the class implements readObject false if the class does not implement readObject

getPrivateWriteObjectMethod

static Method getPrivateWriteObjectMethod(Class<?> cl)
Return true if the given class cl implements private method writeObject().

Parameters:
cl - a java.lang.Class which to test
Returns:
true if the class implements writeObject false if the class does not implement writeObject

isExternalizable

static boolean isExternalizable(Class<?> cl)
Return true if instances of class cl are Externalizable, false otherwise.

Parameters:
cl - a java.lang.Class which to test
Returns:
true if instances of the class are Externalizable false if instances of the class are not Externalizable
See Also:
Object.hashCode()

isPrimitiveType

static boolean isPrimitiveType(char typecode)
Return true if the type code typecode describes a primitive type

Parameters:
typecode - a char describing the typecode
Returns:
true if the typecode represents a primitive type false if the typecode represents an Object type (including arrays)
See Also:
Object.hashCode()

isSerializable

static boolean isSerializable(Class<?> cl)
Return true if instances of class cl are Serializable, false otherwise.

Parameters:
cl - a java.lang.Class which to test
Returns:
true if instances of the class are Serializable false if instances of the class are not Serializable
See Also:
Object.hashCode()

lookup

public static ObjectStreamClass lookup(Class<?> cl)
Return the descriptor (ObjectStreamClass) corresponding to the class cl. If the class is not Serializable or Externalizable, null is returned.

Parameters:
cl - a java.langClass for which to obtain the corresponding descriptor
Returns:
null if instances of the class cl are not Serializable or Externalizable ObjectStreamClass The corresponding descriptor if the class cl is Serializable or Externalizable

lookupStreamClass

static ObjectStreamClass lookupStreamClass(Class<?> cl)
Return the descriptor (ObjectStreamClass) corresponding to the class cl. Returns an ObjectStreamClass even if instances of the class cannot be serialized

Parameters:
cl - a java.langClass for which to obtain the corresponding descriptor
Returns:
the corresponding descriptor

methodReadResolve

static Method methodReadResolve(Class<?> cl)
Return the java.lang.reflect.Method readResolve if class cl implements it. Return null otherwise.

Parameters:
cl - a java.lang.Class which to test
Returns:
java.lang.reflect.Method if the class implements readResolve null if the class does not implement readResolve

methodWriteReplace

static Method methodWriteReplace(Class<?> cl)
Return the java.lang.reflect.Method writeReplace if class cl implements it. Return null otherwise.

Parameters:
cl - a java.lang.Class which to test
Returns:
java.lang.reflect.Method if the class implements writeReplace null if the class does not implement writeReplace

setClass

void setClass(Class<?> c)
Set the class (java.lang.Class) that the receiver represents

Parameters:
c - aClass, the new class that the receiver describes

setFields

void setFields(ObjectStreamField[] f)
Set the collection of field descriptors for the fields of the corresponding class

Parameters:
f - ObjectStreamField[], the receiver's new collection of declared fields for the class it represents

setLoadFields

void setLoadFields(ObjectStreamField[] f)
Set the collection of field descriptors for the input fields of the corresponding class

Parameters:
f - ObjectStreamField[], the receiver's new collection of input fields for the class it represents

setFlags

void setFlags(byte b)
Set the flags for this descriptor, where possible combined values are ObjectStreamConstants.SC_WRITE_METHOD ObjectStreamConstants.SC_SERIALIZABLE ObjectStreamConstants.SC_EXTERNALIZABLE

Parameters:
b - byte, the receiver's new flags for the class it represents

setName

void setName(String newName)
Set the name of the class represented by the receiver

Parameters:
newName - a String, the new fully qualified name of the class the receiver represents

setSerialVersionUID

void setSerialVersionUID(long l)
Set the Serial Version User ID of the class represented by the receiver

Parameters:
l - a long, the new SUID for the class represented by the receiver

setSuperclass

void setSuperclass(ObjectStreamClass c)
Set the descriptor for the superclass of the class described by the receiver

Parameters:
c - an ObjectStreamClass, the new ObjectStreamClass for the superclass of the class represented by the receiver

toString

public String toString()
Returns a string containing a concise, human-readable description of the receiver.

Overrides:
toString in class Object
Returns:
a printable representation for the receiver.

Build 1.0_r1(from source)

Please submit a feedback, bug or feature