Class Reflector
java.lang.Object
com.googlecode.aviator.utils.Reflector
Some code is copied from
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Reflector.java
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classClass's instance method cache key(package private) static classstatic enumstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic ConcurrentHashMap<Class<?>, Reference<Map<String, Reflector.PropertyFoundResult>>> static method cachingstatic ConcurrentHashMap<Class<?>, Reference<Map<String, Reflector.PropertyFoundResult>>> static and instance fields property cachingprivate static final ReferenceQueue<Map<String, Reflector.PropertyFoundResult>> static ConcurrentHashMap<Class<?>, Reference<Map<String, Reflector.PropertyFoundResult>>> instance fields setter caching.private static final ReferenceQueue<Map<String, Reflector.PropertyFoundResult>> private static final ReferenceQueue<Map<String, Reflector.PropertyFoundResult>> (package private) static ConcurrentHashMap<Reflector.MethodKey, Reference<List<Method>>> (package private) static final ReferenceQueue<List<Method>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Objectstatic Object[]static StringBuildercapitalize(StringBuilder sb, String s) (package private) static <K,V> void clearCache(ReferenceQueue<V> rq, ConcurrentHashMap<K, Reference<V>> cache) static ObjectfastGetProperty(Object obj, String name, Reflector.PropertyType type) static ObjectfastGetProperty(String name, String[] names, Map<String, Object> env, Reflector.Target target, boolean tryResolveStaticMethod, int offset, int len) findMethodsFromClass(Class<?> clazz, boolean isStatic) private static StringgenGetterName(String prefix, String name) private static ThrowablegetClassInstanceMethods(Class<?> c, String methodName) private static Map<String, Reflector.PropertyFoundResult> getClassPropertyResults(ConcurrentHashMap<Class<?>, Reference<Map<String, Reflector.PropertyFoundResult>>> cache, ReferenceQueue<Map<String, Reflector.PropertyFoundResult>> rq, Class<?> clazz) getInstanceMethods(Class<?> clazz, String methodName) static ObjectgetProperty(Object target, String name) getStaticMethods(Class<?> c, String methodName) static ObjectinvokeInstanceMethod(Class<?> c, String methodName, Object target, List<Method> methods, Object[] args) (package private) static ObjectinvokeMatchingMethod(String methodName, List methods, Object target, Object[] args) static Objectstatic booleanisCongruent(Class<?>[] params, Object[] args) private static StringnoMethodReport(String methodName, Object target, Object[] args) static booleanparamArgTypeMatch(Class<?> paramType, Class<?> argType) private static voidputDummyHandle(String name, Map<String, Reflector.PropertyFoundResult> handles) private static Reflector.PropertyFoundResultretrieveGetterHandle(Map<String, Reflector.PropertyFoundResult> results, Class<?> clazz, String name) private static Reflector.PropertyFoundResultretrieveSetterHandle(Map<String, Reflector.PropertyFoundResult> results, Class<?> clazz, String name) private static Reflector.PropertyFoundResultretrieveStaticFieldHandle(Map<String, Reflector.PropertyFoundResult> results, Class<?> clazz, String name) private static Reflector.PropertyFoundResultretrieveStaticFunction(Map<String, Reflector.PropertyFoundResult> results, Class<?> clazz, String name) static voidstatic RuntimeExceptionThrow even checked exceptions without being required to declare them or catch them.private static <T extends Throwable>
voidstatic booleanstatic Object
-
Field Details
-
cachedProperties
public static ConcurrentHashMap<Class<?>, Reference<Map<String, Reflector.PropertyFoundResult>>> cachedPropertiesstatic and instance fields property caching -
cachedSettters
public static ConcurrentHashMap<Class<?>, Reference<Map<String, Reflector.PropertyFoundResult>>> cachedSetttersinstance fields setter caching. -
cachedSetterRq
-
cachePropertyRq
-
cachedMethods
public static ConcurrentHashMap<Class<?>, Reference<Map<String, Reflector.PropertyFoundResult>>> cachedMethodsstatic method caching -
cacheMethodRq
-
instanceMethodsCache
-
instanceMethodsRq
-
longClasses
-
doubleClasses
-
-
Constructor Details
-
Reflector
public Reflector()
-
-
Method Details
-
sneakyThrow
Throw even checked exceptions without being required to declare them or catch them. Suggested idiom:throw sneakyThrow( some exception ); -
sneakyThrow0
-
noMethodReport
-
subsumes
-
getCauseOrElse
-
invokeMatchingMethod
-
capitalize
-
genGetterName
-
fastGetProperty
-
throwNoSuchPropertyException
-
retrieveStaticFieldHandle
private static Reflector.PropertyFoundResult retrieveStaticFieldHandle(Map<String, Reflector.PropertyFoundResult> results, Class<?> clazz, String name) throws IllegalAccessException, NoSuchFieldException -
retrieveStaticFunction
private static Reflector.PropertyFoundResult retrieveStaticFunction(Map<String, Reflector.PropertyFoundResult> results, Class<?> clazz, String name) throws IllegalAccessException, NoSuchMethodException -
retrieveGetterHandle
private static Reflector.PropertyFoundResult retrieveGetterHandle(Map<String, Reflector.PropertyFoundResult> results, Class<?> clazz, String name) throws IllegalAccessException - Throws:
IllegalAccessException
-
retrieveSetterHandle
private static Reflector.PropertyFoundResult retrieveSetterHandle(Map<String, Reflector.PropertyFoundResult> results, Class<?> clazz, String name) throws IllegalAccessException - Throws:
IllegalAccessException
-
putDummyHandle
-
getClassPropertyResults
private static Map<String, Reflector.PropertyFoundResult> getClassPropertyResults(ConcurrentHashMap<Class<?>, Reference<Map<String, Reflector.PropertyFoundResult>>> cache, ReferenceQueue<Map<String, Reflector.PropertyFoundResult>> rq, Class<?> clazz) -
getStaticMethods
-
clearCache
-
getInstanceMethods
-
getClassInstanceMethods
-
invokeStaticMethod
-
invokeInstanceMethod
-
boxArg
-
boxArgs
-
asSet
-
paramArgTypeMatch
-
isCongruent
-
getProperty
-
setProperty
-
fastGetProperty
-
findMethodsFromClass
-