private static ThreadLocalProxy<?> getFieldThreadLocalProxy(Field f, Object provider) { if (provider != null) { Object proxy = null; synchronized (provider) { try { proxy = InjectionUtils.extractFieldValue(f, provider); } catch (Throwable t) { // continue } if (!(proxy instanceof ThreadLocalProxy)) { proxy = InjectionUtils.createThreadLocalProxy(f.getType()); InjectionUtils.injectFieldValue(f, provider, proxy); } } return (ThreadLocalProxy<?>) proxy; } else { return InjectionUtils.createThreadLocalProxy(f.getType()); } }
private static ThreadLocalProxy<?> getMethodThreadLocalProxy(Method m, Object provider) { if (provider != null) { Object proxy = null; synchronized (provider) { try { proxy = InjectionUtils.extractFromMethod( provider, InjectionUtils.getGetterFromSetter(m), false); } catch (Throwable t) { // continue } if (!(proxy instanceof ThreadLocalProxy)) { proxy = InjectionUtils.createThreadLocalProxy(m.getParameterTypes()[0]); InjectionUtils.injectThroughMethod(provider, m, proxy); } } return (ThreadLocalProxy<?>) proxy; } else { return InjectionUtils.createThreadLocalProxy(m.getParameterTypes()[0]); } }