Java Reference
In-Depth Information
You may include or exclude a package or a class from appearing on the Serialized Form page by using the include
or exclude argument with the @serial tag. If the @serial tag is used at both package and class levels, the class level tag
takes precedence. By default, a serializable class that is public or protected is included in the Serialized Form page.
The following documentation comment excludes the Dummy class from the Serialized Form page:
/**
* A dummy class. It will not appear on the serialized Form page.
*
* @serial exclude
*/
public class Dummy implements java.io.Serializable {
/**
* @serial The description for value field goes here
*/
private int value;
}
@serialData <data-description>
A class that implement java.io.Externalizable interface needs to implement readExternal() and
writeExternal() methods. A serializable class may also implement writeObject() , readObject() , writeReplace() ,
and readResolve() methods to customize the serialization of the objects of the class. The @serialData tag may be
used with the documentation comments of any of these six methods. The data description text should describe the
types and the order of the data in the serialized form.
@serialField <field-name> <field-type> <field-description>
A serializable class can include a serialPersistentFields field that is an array of ObjectStreamField . The @serialField
tag describes each component of that array. The description of the elements will appear in the Serialized Form page.
The following documentation comment uses @serialField tags to document the name and the height components
of the ObjectStreamField :
package com.jdojo.utility;
import java.io.ObjectStreamField;
import java.io.Serializable;
/**
* A class to represent a person
*/
public class Person implements Serializable {
private String name;
private String gender;
private double height;
/**
* @serialField name String The name of the person
* @serialField height double The height of the person in feet
*/
 
Search WWH ::




Custom Search