public Object createProxy(Errors errors, Class<?> expectedType) throws ErrorsException { // TODO: if I create a proxy which implements all the interfaces of // the implementation type, I'll be able to get away with one proxy // instance (as opposed to one per caller). if (!expectedType.isInterface()) { throw errors.cannotSatisfyCircularDependency(expectedType).toException(); } if (invocationHandlers == null) { invocationHandlers = new ArrayList<>(); } DelegatingInvocationHandler<T> invocationHandler = new DelegatingInvocationHandler<>(); invocationHandlers.add(invocationHandler); // ES: Replace, since we don't use bytecode gen, just get the type class loader, or system if its null //ClassLoader classLoader = BytecodeGen.getClassLoader(expectedType); ClassLoader classLoader = expectedType.getClassLoader() == null ? ClassLoader.getSystemClassLoader() : expectedType.getClassLoader(); return expectedType.cast(Proxy.newProxyInstance(classLoader, new Class[]{expectedType}, invocationHandler)); }
public Object createProxy(Errors errors, Class<?> expectedType) throws ErrorsException { // TODO: if I create a proxy which implements all the interfaces of // the implementation type, I'll be able to get away with one proxy // instance (as opposed to one per caller). if (!expectedType.isInterface()) { throw errors.cannotSatisfyCircularDependency(expectedType).toException(); } if (invocationHandlers == null) { invocationHandlers = new ArrayList<>(); } DelegatingInvocationHandler<T> invocationHandler = new DelegatingInvocationHandler<>(); invocationHandlers.add(invocationHandler); // ES: Replace, since we don't use bytecode gen, just get the type class loader, or system if its null //ClassLoader classLoader = BytecodeGen.getClassLoader(expectedType); ClassLoader classLoader = expectedType.getClassLoader() == null ? ClassLoader.getSystemClassLoader() : expectedType.getClassLoader(); return expectedType.cast(Proxy.newProxyInstance(classLoader, new Class[]{expectedType}, invocationHandler)); }
public Object createProxy(Errors errors, Class<?> expectedType) throws ErrorsException { // TODO: if I create a proxy which implements all the interfaces of // the implementation type, I'll be able to get away with one proxy // instance (as opposed to one per caller). if (!expectedType.isInterface()) { throw errors.cannotSatisfyCircularDependency(expectedType).toException(); } if (invocationHandlers == null) { invocationHandlers = new ArrayList<>(); } DelegatingInvocationHandler<T> invocationHandler = new DelegatingInvocationHandler<>(); invocationHandlers.add(invocationHandler); // ES: Replace, since we don't use bytecode gen, just get the type class loader, or system if its null //ClassLoader classLoader = BytecodeGen.getClassLoader(expectedType); ClassLoader classLoader = expectedType.getClassLoader() == null ? ClassLoader.getSystemClassLoader() : expectedType.getClassLoader(); return expectedType.cast(Proxy.newProxyInstance(classLoader, new Class[]{expectedType}, invocationHandler)); }
public Object createProxy(Errors errors, Class<?> expectedType) throws ErrorsException { // TODO: if I create a proxy which implements all the interfaces of // the implementation type, I'll be able to get away with one proxy // instance (as opposed to one per caller). if (!expectedType.isInterface()) { throw errors.cannotSatisfyCircularDependency(expectedType).toException(); } if (invocationHandlers == null) { invocationHandlers = new ArrayList<>(); } DelegatingInvocationHandler<T> invocationHandler = new DelegatingInvocationHandler<>(); invocationHandlers.add(invocationHandler); // ES: Replace, since we don't use bytecode gen, just get the type class loader, or system if its null //ClassLoader classLoader = BytecodeGen.getClassLoader(expectedType); ClassLoader classLoader = expectedType.getClassLoader() == null ? ClassLoader.getSystemClassLoader() : expectedType.getClassLoader(); return expectedType.cast(Proxy.newProxyInstance(classLoader, new Class[]{expectedType}, invocationHandler)); }
public Object createProxy(Errors errors, Class<?> expectedType) throws ErrorsException { // TODO: if I create a proxy which implements all the interfaces of // the implementation type, I'll be able to get away with one proxy // instance (as opposed to one per caller). if (!expectedType.isInterface()) { throw errors.cannotSatisfyCircularDependency(expectedType).toException(); } if (invocationHandlers == null) { invocationHandlers = new ArrayList<>(); } DelegatingInvocationHandler<T> invocationHandler = new DelegatingInvocationHandler<>(); invocationHandlers.add(invocationHandler); // ES: Replace, since we don't use bytecode gen, just get the type class loader, or system if its null //ClassLoader classLoader = BytecodeGen.getClassLoader(expectedType); ClassLoader classLoader = expectedType.getClassLoader() == null ? ClassLoader.getSystemClassLoader() : expectedType.getClassLoader(); return expectedType.cast(Proxy.newProxyInstance(classLoader, new Class[]{expectedType}, invocationHandler)); }
public void setProxyDelegates(T delegate) { if (invocationHandlers != null) { for (DelegatingInvocationHandler<T> handler : invocationHandlers) { handler.setDelegate(delegate); } } }
public void setProxyDelegates(T delegate) { if (invocationHandlers != null) { for (DelegatingInvocationHandler<T> handler : invocationHandlers) { handler.setDelegate(delegate); } } }
public void setProxyDelegates(T delegate) { if (invocationHandlers != null) { for (DelegatingInvocationHandler<T> handler : invocationHandlers) { handler.setDelegate(delegate); } } }
public void setProxyDelegates(T delegate) { if (invocationHandlers != null) { for (DelegatingInvocationHandler<T> handler : invocationHandlers) { handler.setDelegate(delegate); } } }
public void setProxyDelegates(T delegate) { if (invocationHandlers != null) { for (DelegatingInvocationHandler<T> handler : invocationHandlers) { handler.setDelegate(delegate); } } }