public class Traverser
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.Object |
IGNORE_RESULT |
protected static Traverser |
instance
The default cloner.
|
protected java.util.Map<java.lang.Class<?>,ITraverseProcessor> |
processorcache |
protected static java.util.List<ITraverseProcessor> |
processors
The default traversal processors with no special actions.
|
Constructor and Description |
---|
Traverser() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
doTraverse(java.lang.Object object,
java.lang.reflect.Type type,
java.util.Map<java.lang.Object,java.lang.Object> traversed,
java.util.List<ITraverseProcessor> processors,
boolean clone,
java.lang.ClassLoader targetcl,
java.lang.Object context)
Traverse an object.
|
protected java.lang.Class<?> |
findClazz(java.lang.Object object,
java.lang.ClassLoader cl)
Find the class of an object.
|
static java.util.List<ITraverseProcessor> |
getDefaultProcessors()
Get the default traversal processors.
|
static Traverser |
getInstance()
Get the default cloner instance.
|
void |
handleDuplicate(java.lang.Object object,
java.lang.Class<?> clazz,
java.lang.Object match,
java.util.List<ITraverseProcessor> processors,
boolean clone,
java.lang.Object context)
Special handling for duplicate objects.
|
java.lang.Object |
handleNull(java.lang.Class<?> clazz,
java.util.List<ITraverseProcessor> processors,
boolean clone,
java.lang.Object context)
Special handling for null objects.
|
java.lang.Object |
traverse(java.lang.Object object,
java.lang.Class<?> clazz,
java.util.List<ITraverseProcessor> processors,
boolean clone,
java.lang.ClassLoader targetcl,
java.lang.Object context)
Traverse an object.
|
java.lang.Object |
traverse(java.lang.Object object,
java.lang.Class<?> clazz,
java.util.List<ITraverseProcessor> processors,
java.lang.ClassLoader targetcl,
java.lang.Object context)
Traverse an object.
|
java.lang.Object |
traverse(java.lang.Object object,
java.lang.reflect.Type clazz,
java.util.Map<java.lang.Object,java.lang.Object> traversed,
java.util.List<ITraverseProcessor> processors,
boolean clone,
java.lang.ClassLoader targetcl,
java.lang.Object context)
Traverse an object.
|
static java.lang.Object |
traverseObject(java.lang.Object object,
java.lang.Class<?> clazz,
java.util.List<ITraverseProcessor> processors,
boolean clone,
java.lang.ClassLoader targetcl,
java.lang.Object context)
Traverse an object.
|
static java.lang.Object |
traverseObject(java.lang.Object object,
java.lang.Class<?> clazz,
java.util.List<ITraverseProcessor> processors,
boolean clone,
java.lang.Object context)
Traverse an object.
|
static java.lang.Object |
traverseObject(java.lang.Object object,
java.util.List<ITraverseProcessor> processors,
boolean clone,
java.lang.ClassLoader targetcl,
java.lang.Object context)
Traverse an object.
|
static java.lang.Object |
traverseObject(java.lang.Object object,
java.util.List<ITraverseProcessor> processors,
boolean clone,
java.lang.Object context)
Traverse an object.
|
public static final java.lang.Object IGNORE_RESULT
protected static volatile Traverser instance
protected static final java.util.List<ITraverseProcessor> processors
protected java.util.Map<java.lang.Class<?>,ITraverseProcessor> processorcache
public static java.util.List<ITraverseProcessor> getDefaultProcessors()
public static Traverser getInstance()
public static java.lang.Object traverseObject(java.lang.Object object, java.util.List<ITraverseProcessor> processors, boolean clone, java.lang.Object context)
object
- The object to traverse.processors
- The lists of processors.public static java.lang.Object traverseObject(java.lang.Object object, java.util.List<ITraverseProcessor> processors, boolean clone, java.lang.ClassLoader targetcl, java.lang.Object context)
object
- The object to traverse.processors
- The lists of processors.targetcl
- If not null, the traverser should make sure that the result object is compatible with the class loader,
e.g. by cloning the object using the class loaded from the target class loader.public static java.lang.Object traverseObject(java.lang.Object object, java.lang.Class<?> clazz, java.util.List<ITraverseProcessor> processors, boolean clone, java.lang.Object context)
object
- The object to traverse.processors
- The lists of processors.public static java.lang.Object traverseObject(java.lang.Object object, java.lang.Class<?> clazz, java.util.List<ITraverseProcessor> processors, boolean clone, java.lang.ClassLoader targetcl, java.lang.Object context)
object
- The object to traverse.processors
- The lists of processors.targetcl
- If not null, the traverser should make sure that the result object is compatible with the class loader,
e.g. by cloning the object using the class loaded from the target class loader.public java.lang.Object traverse(java.lang.Object object, java.lang.Class<?> clazz, java.util.List<ITraverseProcessor> processors, java.lang.ClassLoader targetcl, java.lang.Object context)
object
- The object.targetcl
- If not null, the traverser should make sure that the result object is compatible with the class loader,
e.g. by cloning the object using the class loaded from the target class loader.public java.lang.Object traverse(java.lang.Object object, java.lang.Class<?> clazz, java.util.List<ITraverseProcessor> processors, boolean clone, java.lang.ClassLoader targetcl, java.lang.Object context)
object
- The object.targetcl
- If not null, the traverser should make sure that the result object is compatible with the class loader,
e.g. by cloning the object using the class loaded from the target class loader.public java.lang.Object traverse(java.lang.Object object, java.lang.reflect.Type clazz, java.util.Map<java.lang.Object,java.lang.Object> traversed, java.util.List<ITraverseProcessor> processors, boolean clone, java.lang.ClassLoader targetcl, java.lang.Object context)
object
- The object.targetcl
- If not null, the traverser should make sure that the result object is compatible with the class loader,
e.g. by cloning the object using the class loaded from the target class loader.public java.lang.Object doTraverse(java.lang.Object object, java.lang.reflect.Type type, java.util.Map<java.lang.Object,java.lang.Object> traversed, java.util.List<ITraverseProcessor> processors, boolean clone, java.lang.ClassLoader targetcl, java.lang.Object context)
object
- The object.targetcl
- If not null, the traverser should make sure that the result object is compatible with the class loader,
e.g. by cloning the object using the class loaded from the target class loader.protected java.lang.Class<?> findClazz(java.lang.Object object, java.lang.ClassLoader cl)
object
- The object.cl
- The classloader.public void handleDuplicate(java.lang.Object object, java.lang.Class<?> clazz, java.lang.Object match, java.util.List<ITraverseProcessor> processors, boolean clone, java.lang.Object context)
public java.lang.Object handleNull(java.lang.Class<?> clazz, java.util.List<ITraverseProcessor> processors, boolean clone, java.lang.Object context)