Package sun.reflect

Examples of sun.reflect.ReflectionFactory


        return true;
    }

    private static Field[] copyFields(Field[] arg) {
        Field[] out = new Field[arg.length];
        ReflectionFactory fact = getReflectionFactory();
        for (int i = 0; i < arg.length; i++) {
            out[i] = fact.copyField(arg[i]);
        }
        return out;
    }
View Full Code Here


        return out;
    }

    private static Method[] copyMethods(Method[] arg) {
        Method[] out = new Method[arg.length];
        ReflectionFactory fact = getReflectionFactory();
        for (int i = 0; i < arg.length; i++) {
            out[i] = fact.copyMethod(arg[i]);
        }
        return out;
    }
View Full Code Here

        return out;
    }

    private static Constructor[] copyConstructors(Constructor[] arg) {
        Constructor[] out = new Constructor[arg.length];
        ReflectionFactory fact = getReflectionFactory();
        for (int i = 0; i < arg.length; i++) {
            out[i] = fact.copyConstructor(arg[i]);
        }
        return out;
    }
View Full Code Here

      // Because the newer JVMs throw a VerifyError if a class attempts to in a constructor other than their superclasses constructor,
      // and because we can't know what objects/values we need to pass into the class being proxied constructor,
      // we instantiate the proxy class using the ReflectionFactory.newConstructorForSerialization() method which allows us to instantiate the
      // proxy class without calling the proxy class' constructor. It is in fact using the java.lang.Object constructor so is in effect
      // doing what we were doing before.
      ReflectionFactory factory = ReflectionFactory.getReflectionFactory();
      Constructor<?> constr = Object.class.getConstructor();
      Constructor<?> subclassConstructor = factory.newConstructorForSerialization(generatedProxySubclass, constr);
      proxySubclassInstance = subclassConstructor.newInstance();
     
      Method setIHMethod = proxySubclassInstance.getClass().getMethod("setInvocationHandler", InvocationHandler.class);
      setIHMethod.invoke(proxySubclassInstance, ih);
      LOGGER.debug("Invoked proxy subclass constructor");
View Full Code Here

        return out;
    }

    private static Method[] copyMethods(Method[] arg) {
        Method[] out = new Method[arg.length];
        ReflectionFactory fact = getReflectionFactory();
        for (int i = 0; i < arg.length; i++) {
            out[i] = fact.copyMethod(arg[i]);
        }
        return out;
    }
View Full Code Here

        return out;
    }

    private static <U> Constructor<U>[] copyConstructors(Constructor<U>[] arg) {
        Constructor<U>[] out = arg.clone();
        ReflectionFactory fact = getReflectionFactory();
        for (int i = 0; i < out.length; i++) {
            out[i] = fact.copyConstructor(out[i]);
        }
        return out;
    }
View Full Code Here

        return true;
    }

    private static Field[] copyFields(Field[] arg) {
        Field[] out = new Field[arg.length];
        ReflectionFactory fact = getReflectionFactory();
        for (int i = 0; i < arg.length; i++) {
            out[i] = fact.copyField(arg[i]);
        }
        return out;
    }
View Full Code Here

        return out;
    }

    private static Method[] copyMethods(Method[] arg) {
        Method[] out = new Method[arg.length];
        ReflectionFactory fact = getReflectionFactory();
        for (int i = 0; i < arg.length; i++) {
            out[i] = fact.copyMethod(arg[i]);
        }
        return out;
    }
View Full Code Here

        return out;
    }

    private static <U> Constructor<U>[] copyConstructors(Constructor<U>[] arg) {
        Constructor<U>[] out = arg.clone();
        ReflectionFactory fact = getReflectionFactory();
        for (int i = 0; i < out.length; i++) {
            out[i] = fact.copyConstructor(out[i]);
        }
        return out;
    }
View Full Code Here

    private final Constructor mungedConstructor;

    public SunReflectionFactorySerializationInstantiator(final Class type) {

        final Class nonSerializableAncestor = SerializationInstantiatorHelper.getNonSerializableSuperClass( type );
        final ReflectionFactory reflectionFactory = ReflectionFactory.getReflectionFactory();
        Constructor nonSerializableAncestorConstructor;
        try {
            nonSerializableAncestorConstructor = nonSerializableAncestor.getConstructor( (Class[]) null );
        } catch ( final NoSuchMethodException e ) {
            /**
             * @todo (Henri) I think we should throw a NotSerializableException just to put the same
             *       message a ObjectInputStream. Otherwise, the user won't know if the null returned
             *       if a "Not serializable", a "No default constructor on ancestor" or a "Exception in
             *       constructor"
             */
            throw new ObjenesisException( new NotSerializableException( type + " has no suitable superclass constructor" ) );
        }

        this.mungedConstructor = reflectionFactory.newConstructorForSerialization( type,
                                                                              nonSerializableAncestorConstructor );
        this.mungedConstructor.setAccessible( true );
    }
View Full Code Here

TOP

Related Classes of sun.reflect.ReflectionFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.