Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.jboss.as.ejb3.remote;
 
 
org.jboss.marshalling.cloner.ClassCloner that clones classes between class loaders, falling back to original class if it cannot be found in the destination class loader.

Author(s):
Stuart Douglas
public class LocalInvocationClassCloner implements ClassCloner {
    private final ClassLoader destClassLoader;
    public LocalInvocationClassCloner(final ClassLoader destClassLoader) {
        this. = destClassLoader;
    }
    public Class<?> clone(final Class<?> originalthrows IOExceptionClassNotFoundException {
        final String name = original.getName();
        if (name.startsWith("java.")) {
            return original;
        } else if (original.getClassLoader() == ) {
            return original;
        } else {
            try {
                return Class.forName(nametrue);
            } catch (ClassNotFoundException e) {
                return original;
            }
        }
    }
    public Class<?> cloneProxy(final Class<?> proxyClassthrows IOExceptionClassNotFoundException {
        final Class<?>[] origInterfaces = proxyClass.getInterfaces();
        final Class<?>[] interfaces = new Class[origInterfaces.length];
        for (int i = 0, origInterfacesLength = origInterfaces.lengthi < origInterfacesLengthi++) {
            interfaces[i] = clone(origInterfaces[i]);
        }
        return Proxy.getProxyClass(interfaces);
    }
New to GrepCode? Check out our FAQ X