/** * Creates a class map for specific class and registers it in the * cache. Also adds the qualified name to the name->class map * for later Classloader change detection. */ protected ClassMap createClassMap(Class c) { ClassMap classMap = new ClassMap( c ); classMethodMaps.put(c, classMap); cachedClassNames.add( c.getName() ); return classMap; }
/** * Standard constructor * @param clazz The class for which this ClassMap gets constructed. * @param log logger * @param conversionHandler conversion handler * @since 2.0 */ public ClassMap(final Class clazz, final Logger log, final ConversionHandler conversionHandler) { this.clazz = clazz; this.log = log; if (debugReflection) { log.debug("================================================================="); log.debug("== Class: {}", clazz); } methodCache = createMethodCache(conversionHandler); if (debugReflection) { log.debug("================================================================="); } }
for (Class classToReflect = getCachedClass(); classToReflect != null ; classToReflect = classToReflect.getSuperclass()) populateMethodCacheWith(methodCache, classToReflect); populateMethodCacheWithInterface(methodCache, interfaces[i]);
private void populateMethodCacheWithInterface(MethodCache methodCache, Class iface) { if (Modifier.isPublic(iface.getModifiers())) { populateMethodCacheWith(methodCache, iface); } Class[] supers = iface.getInterfaces(); for (int i=0; i < supers.length; i++) { populateMethodCacheWithInterface(methodCache, supers[i]); } }
Method[] methods = getAccessibleMethods(clazz); Method publicMethod = getPublicMethod( method ); methodCache.put( makeMethodKey( publicMethod), publicMethod);
return classMap.findMethod(name, params);
upcastCount = getAccessibleMethods(superclazz , methodInfos, upcastCount); upcastCount = getAccessibleMethods(interfaces[i], methodInfos, upcastCount);
private void populateMethodCacheWithInterface(MethodCache methodCache, Class iface) { if (Modifier.isPublic(iface.getModifiers())) { populateMethodCacheWith(methodCache, iface); } Class[] supers = iface.getInterfaces(); for (Class aSuper : supers) { populateMethodCacheWithInterface(methodCache, aSuper); } }
/** * Gets the method defined by <code>name</code> and * <code>params</code> for the Class <code>c</code>. * * @param c Class in which the method search is taking place * @param name Name of the method being searched for * @param params An array of Objects (not Classes) that describe the * the parameters * * @return The desired Method object. * @throws NullPointerException When the parameters passed in can not be used for introspection because null. * @throws MethodMap.AmbiguousException When the method map contains more than one match for the requested signature. */ public Method getMethod(final Class c, final String name, final Object[] params) throws MethodMap.AmbiguousException { IntrospectorCache ic = getIntrospectorCache(); ClassMap classMap = ic.get(Validate.notNull(c, "class object is null!")); if (classMap == null) { classMap = ic.put(c); } return classMap.findMethod(name, Validate.notNull(params, "params object is null!")); }
int upcastCount = getAccessibleMethods(clazz, methodInfos, 0);
for (Class classToReflect = getCachedClass(); classToReflect != null ; classToReflect = classToReflect.getSuperclass()) populateMethodCacheWith(methodCache, classToReflect); populateMethodCacheWithInterface(methodCache, interfaces[i]);
private void populateMethodCacheWithInterface(MethodCache methodCache, Class iface) { if (Modifier.isPublic(iface.getModifiers())) { populateMethodCacheWith(methodCache, iface); } Class[] supers = iface.getInterfaces(); for (int i=0; i < supers.length; i++) { populateMethodCacheWithInterface(methodCache, supers[i]); } }
/** * Creates a class map for specific class and registers it in the * cache. Also adds the qualified name to the name->class map * for later Classloader change detection. * * @param c The class for which the class map gets generated. * @return A ClassMap object. */ public ClassMap put(final Class c) { final ClassMap classMap = new ClassMap(c, log); synchronized (classMapCache) { classMapCache.put(c, classMap); classNameCache.add(c.getName()); } return classMap; }
return classMap.findMethod(name, params);
/** * Standard constructor * @param clazz The class for which this ClassMap gets constructed. */ public ClassMap(final Class clazz, final Log log) { this.clazz = clazz; this.log = log; if (debugReflection && log.isDebugEnabled()) { log.debug("================================================================="); log.debug("== Class: " + clazz); } methodCache = createMethodCache(); if (debugReflection && log.isDebugEnabled()) { log.debug("================================================================="); } }
for (Class classToReflect = getCachedClass(); classToReflect != null ; classToReflect = classToReflect.getSuperclass()) populateMethodCacheWith(methodCache, classToReflect); populateMethodCacheWithInterface(methodCache, anInterface);
/** * Creates a class map for specific class and registers it in the * cache. Also adds the qualified name to the name->class map * for later Classloader change detection. * * @param c The class for which the class map gets generated. * @return A ClassMap object. */ public ClassMap put(final Class c) { final ClassMap classMap = new ClassMap(c, log); synchronized (classMapCache) { classMapCache.put(c, classMap); classNameCache.add(c.getName()); } return classMap; }
return classMap.findMethod(name, params);
/** * Standard constructor * @param clazz The class for which this ClassMap gets constructed. */ public ClassMap(final Class clazz, final Log log) { this.clazz = clazz; this.log = log; if (debugReflection && log.isDebugEnabled()) { log.debug("================================================================="); log.debug("== Class: " + clazz); } methodCache = createMethodCache(); if (debugReflection && log.isDebugEnabled()) { log.debug("================================================================="); } }
/** * Creates a class map for specific class and registers it in the * cache. Also adds the qualified name to the name->class map * for later Classloader change detection. * * @param c The class for which the class map gets generated. * @return A ClassMap object. */ public ClassMap put(final Class c) { final ClassMap classMap = new ClassMap(c, log, conversionHandler); final ClassFieldMap classFieldMap = new ClassFieldMap(c, log); synchronized (classMapCache) { classMapCache.put(c, classMap); classFieldMapCache.put(c, classFieldMap); classNameCache.add(c.getName()); } return classMap; }