org.fuin.serialver4j.base
Class VersionedClass

java.lang.Object
  extended by org.fuin.serialver4j.base.VersionedClass
All Implemented Interfaces:
Serializable

public final class VersionedClass
extends Object
implements Serializable

Class with one or more old versions.

See Also:
Serialized Form

Constructor Summary
VersionedClass(String packageName, String className)
          Constructor with package and name of the current class.
 
Method Summary
 void addVersion(ClassVersion version)
          Adds a version to the class.
 Class<?> classFor(ClassVersion version)
          Creates a class for the given version.
 boolean equals(Object obj)
           
 Class<?> findArchivedClass(Long serialVersionUID)
          Tries to find a version by it's serial version UID.
 List<Class<?>> getArchivedClasses()
          Returns a list of archived classes.
 String getName()
          Returns the full qualified name of the class.
 String getPackageName()
          Returns the package name.
 String getSimpleClassName()
          Returns the simple name of the class.
 int hashCode()
           
 void init()
          Initialize the instance after it has been deserialized.
 void removeVersion(ClassVersion version)
          Removes a version from the class.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VersionedClass

public VersionedClass(String packageName,
                      String className)
Constructor with package and name of the current class.

Parameters:
packageName - Package name.
className - Class name without package.
Method Detail

init

public final void init()
Initialize the instance after it has been deserialized. Transient fields are set properly after calling this method.


addVersion

public final void addVersion(ClassVersion version)
Adds a version to the class.

Parameters:
version - Version to add.

removeVersion

public final void removeVersion(ClassVersion version)
Removes a version from the class.

Parameters:
version - Version to remove.

getName

public final String getName()
Returns the full qualified name of the class.

Returns:
Package + Simple Name.

getPackageName

public final String getPackageName()
Returns the package name.

Returns:
Package name.

getSimpleClassName

public final String getSimpleClassName()
Returns the simple name of the class.

Returns:
Class name without package.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

findArchivedClass

public final Class<?> findArchivedClass(Long serialVersionUID)
Tries to find a version by it's serial version UID.

Parameters:
serialVersionUID - Version to locate.
Returns:
Class or null if the version is unknown.

getArchivedClasses

public final List<Class<?>> getArchivedClasses()
Returns a list of archived classes.

Returns:
List of all known old classes.

classFor

public Class<?> classFor(ClassVersion version)
Creates a class for the given version.

Parameters:
version - Version of the class.
Returns:
Class.

toString

public final String toString()
Overrides:
toString in class Object


Copyright © 2011 Future Invent Informationsmanagement GmbH. All Rights Reserved.