| java.lang.Object org.apache.harmony.lang.reflect.repository.TypeVariableRepository
TypeVariableRepository | final public class TypeVariableRepository (Code) | | (This all should be considered as an experimental approach which could be changed on
java.lang.ref using)
TypeVariableRepository keeps iformation about type variables.
For now the following approach for keeping is realized.
A concreet TV instance is included into repository if somebody do the *first* request for
the reflect's method like Method.getGenericReturnType()->Class.MethodData.initGenericReturnType()
(Field.getGenericType()->Field.FieldData.initGenericType()
Method.getGenericExceptionTypes()->Class.MethodData.initGenericExceptionTypes()
...
Constructor.getGenericParameterTypes()->Class.ConstructorData.initGenericParameterTypes()
...
). If the identical TV is accessed anyhow then the pointer from repository is used. However,
further it can be removed from the repository if the cache is full under the new instance including.
Then if reflect's request for such TV using the earlier used interface methods then the pointers
to such instance kept within the Method/Constructor/Field/Class instances are returned just if it is
absent within repository. But if we use other Method/Constructor/Field/Class instances to access
to some instance of the same TV type which has been removed from repository then the new
exemplar of instance is included into repository and the pointer to it is replicated if it needs
into the new Method/Constructor/Field/Class instances.
Another way to recreate some TV entry within repository is the AuxiliaryFinder.findTypeVariable() method
which can recreate the removed instance getting it within Method/Constructor/Field/Class instances
which were used to acces to the mentioned TV earlier.
Maybe, it would be more convinient to realize another repository implementation
where the accumulative approach will be used.
|
Inner Class :final static class TypeVariableCache | |
Method Summary | |
public static TypeVariable | findTypeVariable(String typeVariableName, Object startPoint) This method returns a registered type variable if it exists within the repository.
Parameters: typeVariableName - a name of a type variable. Parameters: startPoint - an instance of the Class, Method, Constructor or Field type to start the searchof a type variable declaration place. | public static void | registerTypeVariable(TypeVariable typeVariable, String typeVariableName, Object startPoint) This method registers a type variable within the repository. |
findTypeVariable | public static TypeVariable findTypeVariable(String typeVariableName, Object startPoint)(Code) | | This method returns a registered type variable if it exists within the repository.
Parameters: typeVariableName - a name of a type variable. Parameters: startPoint - an instance of the Class, Method, Constructor or Field type to start the searchof a type variable declaration place. the found type variable or null if it does not exist within repository. |
registerTypeVariable | public static void registerTypeVariable(TypeVariable typeVariable, String typeVariableName, Object startPoint)(Code) | | This method registers a type variable within the repository.
Parameters: typeVariable - a type variable. Parameters: typeVariableName - a name of a type variable. Parameters: startPoint - an instance of the Class, Method, Constructor or Field type to start the searchof a type variable declaration place. |
|
|