Spec-Zone .ru
спецификации, руководства, описания, API
CONTENTS | PREV | NEXT Java Object Serialization Specification

4.4 The ObjectStreamField Class

An ObjectStreamField represents a serializable field of a serializable class. The serializable fields of a class can be retrieved from the ObjectStreamClass.

The special static serializable field, serialPersistentFields, is an array of ObjectStreamField components 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();
The ObjectStreamField constructor is used to create a new instance of an ObjectStreamField. The argument is the type of the serializable field. For example, Integer.TYPE or java.lang.Hashtable.class. ObjectStreamField objects are used to specify the serializable fields of a class or to describe the fields present in a stream.

The getName method returns the name of the serializable field.

The getType method returns the type of the field.

The toString method returns a printable representation with name and type.

Copyright © 1997-1999 Sun Microsystems, Inc. All Rights Reserved.