Package javassist

# Class SerialVersionUID

java.lang.Object
javassist.SerialVersionUID

public class SerialVersionUID extends Object
Utility for calculating serialVersionUIDs for Serializable classes.

Author:
  Bob Lee (crazybob@crazybob.org), modified by Shigeru Chiba

## Constructor Summary

Constructors
Constructor
Description
`SerialVersionUID()`

## Method Summary

Modifier and Type
Method
Description
`static long`
`calculateDefault(CtClass clazz)`
Calculate default value.
`static void`
`setSerialVersionUID(CtClass clazz)`
Adds serialVersionUID if one does not already exist.

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### SerialVersionUID

public SerialVersionUID()

## Method Details

### setSerialVersionUID

public static void setSerialVersionUID(CtClass clazz) throws CannotCompileException, NotFoundException
Adds serialVersionUID if one does not already exist. Call this before modifying a class to maintain serialization compatability.

Throws:
  `CannotCompileException`
  `NotFoundException`

### calculateDefault

public static long calculateDefault(CtClass clazz) throws CannotCompileException
Calculate default value. See Java Serialization Specification, Stream Unique Identifiers.

Throws:
  `CannotCompileException`
Since:
  3.20