Saturday, 20 January 2018

Javadoc: @serial: Document meaning of serial fields

@serial tag is used to document the acceptable values and description of serialized fields.

Javadoc tool places this information in the "Serialized Form" page for that class

Ex
/**
 * @serial Serialize PI {@value}
 */
public final double PI = 3.14;

Arithmetic.java

package com.java.tags;

import java.io.Serializable;

/**
 * 
 * @author Hari Krishna
 * 
 * @since 1.0
 */
public class Arithmetic implements Serializable {

 /**
  * Serialization constant value is {@value}
  */
 private static final long serialVersionUID = 1L;

 /**
  * @serial Serialize PI {@value}
  */
 public final double PI = 3.14;

 public double areaOfCircle(int radius) {
  return PI * radius * radius;
 }

}





Previous                                                 Next                                                 Home

No comments:

Post a Comment