private void findContextSetterMethods(Class<?> cls, Object provider) { for (Method m : cls.getMethods()) { if (!m.getName().startsWith("set") || m.getParameterTypes().length != 1) { continue; } for (Annotation a : m.getAnnotations()) { if (a.annotationType() == Context.class) { checkContextMethod(m, provider); break; } } } Class<?>[] interfaces = cls.getInterfaces(); for (Class<?> i : interfaces) { findContextSetterMethods(i, provider); } Class<?> superCls = cls.getSuperclass(); if (superCls != null && superCls != Object.class) { findContextSetterMethods(superCls, provider); } }
private void findContexts( Class<?> cls, Object provider, Map<Class<?>, ThreadLocalProxy<?>> constructorProxies) { findContextFields(cls, provider); findContextSetterMethods(cls, provider); if (constructorProxies != null) { Map<Class<?>, Map<Class<?>, ThreadLocalProxy<?>>> proxies = getConstructorProxyMap(true); proxies.put(serviceClass, constructorProxies); constructorProxiesAvailable = true; } contextsAvailable = contextFields != null && !contextFields.isEmpty() || contextMethods != null && !contextMethods.isEmpty() || constructorProxiesAvailable; }