public class ClassNameResolver
extends java.lang.Object
Constructor and Description |
---|
ClassNameResolver() |
Modifier and Type | Method and Description |
---|---|
void |
addAlias(java.lang.Class clazz,
java.lang.String alias)
Adds a new alias for this class.
|
void |
addDefaults() |
void |
addSearchPath(java.lang.String path)
Deprecated.
This functionality is deprecated. You can continue to add search paths for the backwards
compatability
of deserializing, but new serialized code will not contain the shortened versions of the classnames.
|
java.lang.Class |
classForName(java.lang.String name)
Attempts to find the Class for the given name, in the context of any aliases and search paths that have been
previously configured
Logic is as follows:
Look through the aliases for the given name.
|
protected java.lang.Class |
classForNameImpl(java.lang.String name) |
static ClassNameResolver |
createBasic() |
java.lang.String |
getName(java.lang.Class clazz)
Returns the inverse of
classForName(String) . |
public static ClassNameResolver createBasic()
public void addDefaults()
public void addAlias(java.lang.Class clazz, java.lang.String alias)
@Deprecated public void addSearchPath(java.lang.String path)
path
- public java.lang.String getName(java.lang.Class clazz)
classForName(String)
. That is, the appropriate string for which a call to
classForName with the return value of this method would return clazz. Makes use of any configured
aliases and search paths, and appropriately encodes array types.clazz
- public final java.lang.Class classForName(java.lang.String name) throws java.lang.ClassNotFoundException
addAlias(Class, String)
), and will also be added automatically to act as a cache of any of the following
steps find the class.Array#newInstance(Class, Integer)
addSearchPath(String)
, looking for
Class.forName(searchPath + "." + name)
name
- java.lang.ClassNotFoundException
protected java.lang.Class classForNameImpl(java.lang.String name) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException