T - the cached typepublic abstract class WeakTypeCache<T>
extends java.lang.Object
It creates the class specific data in two stages to avoid recursion.
instantiate - creates the data
generate - fills in the details
| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<java.lang.ClassLoader,java.util.Map<java.lang.String,T>> |
cache
The cache
|
| Constructor and Description |
|---|
WeakTypeCache() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
generate(java.lang.Class<?> clazz,
T result)
Fill in the result
|
protected abstract void |
generate(java.lang.reflect.ParameterizedType type,
T result)
Fill in the result
|
T |
get(java.lang.String name,
java.lang.ClassLoader cl)
Get the information for a class
|
T |
get(java.lang.reflect.Type type)
Get the information for a type
|
protected T |
getClass(java.lang.Class<?> clazz)
Get the information for a class
|
protected java.util.Map<java.lang.String,T> |
getClassLoaderCache(java.lang.ClassLoader cl)
Get the cache for the classloader
|
protected T |
getGenericArrayType(java.lang.reflect.GenericArrayType type)
Get the information for an array type
|
protected T |
getParameterizedType(java.lang.reflect.ParameterizedType type)
Get the information for a parameterized type
|
protected <D extends java.lang.reflect.GenericDeclaration> |
getTypeVariable(java.lang.reflect.TypeVariable<D> type)
Get the information for a type variable
|
protected T |
getWildcardType(java.lang.reflect.WildcardType type)
Get the information for a wildcard type
|
protected abstract T |
instantiate(java.lang.Class<?> clazz)
Instantiate for a class
|
protected abstract T |
instantiate(java.lang.reflect.ParameterizedType type)
Instantiate for a parameterized type
|
protected T |
peek(java.lang.Class<?> clazz)
Peek into the cache
|
protected T |
peek(java.lang.reflect.ParameterizedType type)
Peek into the cache
|
protected void |
put(java.lang.Class<?> clazz,
T result)
Put a result into the cache
|
protected void |
put(java.lang.reflect.ParameterizedType type,
T result)
Put a result into the cache
|
private java.util.Map<java.lang.ClassLoader,java.util.Map<java.lang.String,T>> cache
public T get(java.lang.reflect.Type type)
type - the typepublic T get(java.lang.String name, java.lang.ClassLoader cl) throws java.lang.ClassNotFoundException
name - the namecl - the classloaderjava.lang.ClassNotFoundException - when the class cannot be foundprotected abstract T instantiate(java.lang.Class<?> clazz)
clazz - the classprotected abstract void generate(java.lang.Class<?> clazz,
T result)
clazz - the classresult - the resultprotected abstract T instantiate(java.lang.reflect.ParameterizedType type)
type - the parameterized typeprotected abstract void generate(java.lang.reflect.ParameterizedType type,
T result)
type - the parameterized typeresult - the resultprotected T getParameterizedType(java.lang.reflect.ParameterizedType type)
type - the parameterized typeprotected T getWildcardType(java.lang.reflect.WildcardType type)
type - the paremeterized typeprotected <D extends java.lang.reflect.GenericDeclaration> T getTypeVariable(java.lang.reflect.TypeVariable<D> type)
D - the declarationtype - the type variableprotected T getGenericArrayType(java.lang.reflect.GenericArrayType type)
type - the array typeprotected T peek(java.lang.reflect.ParameterizedType type)
type - the typeprotected void put(java.lang.reflect.ParameterizedType type,
T result)
type - the typeresult - the valueprotected T getClass(java.lang.Class<?> clazz)
clazz - the classprotected T peek(java.lang.Class<?> clazz)
clazz - the classprotected void put(java.lang.Class<?> clazz,
T result)
clazz - the classresult - the valueprotected java.util.Map<java.lang.String,T> getClassLoaderCache(java.lang.ClassLoader cl)
cl - the classloader