| CONTENTS | PREV | NEXT | Java Object Serialization Specification |
AnObjectStreamFieldrepresents a serializable field of a serializable class. The serializable fields of a class can be retrieved from theObjectStreamClass.The special static serializable field,
serialPersistentFields, is an array ofObjectStreamFieldcomponents that is used to override the default serializable fields.package java.io; public class ObjectStreamField { public ObjectStreamField(String fieldName, Class fieldType); public String getName(); public Class getType() throws ClassNotFoundException; public String toString(); }TheObjectStreamFieldconstructor is used to create a new instance of anObjectStreamField. The argument is the type of the serializable field. For example,Integer.TYPEorjava.lang.Hashtable.class.ObjectStreamFieldobjects are used to specify the serializable fields of a class or to describe the fields present in a stream.The
getNamemethod returns the name of the serializable field.The
getTypemethod returns the type of the field.The
toStringmethod returns a printable representation with name and type.