com.jme3.export
Class SavableClassUtil

java.lang.Object
  extended by com.jme3.export.SavableClassUtil

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 Summary
SavableClassUtil()
           
 
Method Summary
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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SavableClassUtil

public SavableClassUtil()
Method Detail

isImplementingSavable

public static boolean isImplementingSavable(java.lang.Class clazz)

getSavableVersions

public static int[] getSavableVersions(java.lang.Class<? extends Savable> clazz)
                                throws java.io.IOException
Throws:
java.io.IOException

getSavableVersion

public static int getSavableVersion(java.lang.Class<? extends Savable> clazz)
                             throws java.io.IOException
Throws:
java.io.IOException

getSavedSavableVersion

public static int getSavedSavableVersion(java.lang.Object savable,
                                         java.lang.Class<? extends Savable> desiredClass,
                                         int[] versions,
                                         int formatVersion)

fromName

public static Savable fromName(java.lang.String className)
                        throws java.lang.InstantiationException,
                               java.lang.IllegalAccessException,
                               java.lang.ClassNotFoundException,
                               java.io.IOException
fromName creates a new Savable from the provided class name. First registered modules are checked to handle special cases, if the modules do not handle the class name, the class is instantiated directly.

Parameters:
className - the class name to create.
inputCapsule - the InputCapsule that will be used for loading the Savable (to look up ctor parameters)
Returns:
the Savable instance of the class.
Throws:
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.ClassNotFoundException - thrown if the class name is not in the classpath.
java.io.IOException - when loading ctor parameters fails

fromName

public static Savable fromName(java.lang.String className,
                               java.util.List<java.lang.ClassLoader> loaders)
                        throws java.lang.InstantiationException,
                               java.lang.IllegalAccessException,
                               java.lang.ClassNotFoundException,
                               java.io.IOException
Throws:
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException
java.io.IOException