public class SavableClassUtil
extends java.lang.Object
SavableClassUtil
contains various utilities to handle
Savable classes. The methods are general enough to not be specific to any
particular implementation.
Currently it will remap any classes from old paths to new paths
so that old J3O models can still be loaded.Constructor and Description |
---|
SavableClassUtil() |
Modifier and Type | Method and Description |
---|---|
static Savable |
fromName(java.lang.String className)
fromName creates a new Savable from the provided class name.
|
static Savable |
fromName(java.lang.String className,
java.util.List<java.lang.ClassLoader> loaders) |
static int |
getSavableVersion(java.lang.Class<? extends Savable> clazz) |
static int[] |
getSavableVersions(java.lang.Class<? extends Savable> clazz) |
static int |
getSavedSavableVersion(java.lang.Object savable,
java.lang.Class<? extends Savable> desiredClass,
int[] versions,
int formatVersion) |
static boolean |
isImplementingSavable(java.lang.Class clazz) |
public static boolean isImplementingSavable(java.lang.Class clazz)
public static int[] getSavableVersions(java.lang.Class<? extends Savable> clazz) throws java.io.IOException
java.io.IOException
public static int getSavableVersion(java.lang.Class<? extends Savable> clazz) throws java.io.IOException
java.io.IOException
public static int getSavedSavableVersion(java.lang.Object savable, java.lang.Class<? extends Savable> desiredClass, int[] versions, int formatVersion)
public static Savable fromName(java.lang.String className) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.reflect.InvocationTargetException
className
- the class name to create.java.lang.InstantiationException
- thrown if the class does not have an empty constructor.java.lang.IllegalAccessException
- thrown if the class is not accessable.java.lang.reflect.InvocationTargetException
java.lang.ClassNotFoundException
- thrown if the class name is not in the classpath.public static Savable fromName(java.lang.String className, java.util.List<java.lang.ClassLoader> loaders) throws java.lang.InstantiationException, java.lang.reflect.InvocationTargetException, java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.ClassNotFoundException, java.io.IOException
java.lang.InstantiationException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException
java.io.IOException