@Test public void testCurrentThreadCanCreateAndUseSubject() { @SuppressWarnings("unchecked") List<String> subject = ThreadConfinedProxy.newProxyInstance(List.class, new ArrayList<String>(), ThreadConfinedProxy.Strictness.VALIDATE); subject.add(testString); assertEquals(testString, Iterables.getOnlyElement(subject)); }
public static <T> T newProxyInstance(Class<T> interfaceClass, T delegate, Strictness strictness) { return newProxyInstance(interfaceClass, delegate, strictness, Thread.currentThread()); }
ThreadConfinedProxy extends AbstractInvocationHandler implements DelegatingInvocationHandler { public static <T> T newProxyInstance(Class<T> interfaceClass, T delegate, Strictness strictness) { return newProxyInstance(interfaceClass, delegate, strictness, Thread.currentThread()); } }
ThreadConfinedProxy extends AbstractInvocationHandler implements DelegatingInvocationHandler { public static <T> T newProxyInstance(Class<T> interfaceClass, T delegate, Strictness strictness) { return newProxyInstance(interfaceClass, delegate, strictness, Thread.currentThread()); } private  ThreadConfinedProxy(Object delegate, Strictness strictness, String threadName, long threadId); }
ThreadConfinedProxy extends AbstractInvocationHandler implements DelegatingInvocationHandler { public static <T> T newProxyInstance(Class<T> interfaceClass, T delegate, Strictness strictness) { return newProxyInstance(interfaceClass, delegate, strictness, Thread.currentThread()); } private  ThreadConfinedProxy(Object delegate, Strictness strictness, String threadName, long threadId); static T newProxyInstance(Class<T> interfaceClass, T delegate, Strictness strictness); static void changeThread(Object proxy, Thread oldThread, Thread newThread); static Callable<T> threadLendingCallable(final Object proxy, final Callable<T> callable); @SuppressWarnings("unchecked") static T newProxyInstance(Class<T> interfaceClass, T delegate, Strictness strictness, Thread current); @Override Object getDelegate(); }
ThreadConfinedProxy extends AbstractInvocationHandler implements DelegatingInvocationHandler { public static <T> T newProxyInstance(Class<T> interfaceClass, T delegate, Strictness strictness) { return newProxyInstance(interfaceClass, delegate, strictness, Thread.currentThread()); } private  ThreadConfinedProxy(Object delegate, Strictness strictness, String threadName, long threadId); static T newProxyInstance(Class<T> interfaceClass, T delegate, Strictness strictness); static void changeThread(Object proxy, Thread oldThread, Thread newThread); static Callable<T> threadLendingCallable(final Object proxy, final Callable<T> callable); @SuppressWarnings("unchecked") static T newProxyInstance(Class<T> interfaceClass, T delegate, Strictness strictness, Thread current); @Override Object getDelegate();  }