Examples of newConstructorForSerialization()


Examples of sun.reflect.ReflectionFactory.newConstructorForSerialization()

      // 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

Examples of sun.reflect.ReflectionFactory.newConstructorForSerialization()

             *       constructor"
             */
            throw new ObjenesisException( new NotSerializableException( type + " has no suitable superclass constructor" ) );
        }

        this.mungedConstructor = reflectionFactory.newConstructorForSerialization( type,
                                                                              nonSerializableAncestorConstructor );
        this.mungedConstructor.setAccessible( true );
    }

    public Object newInstance() {
View Full Code Here

Examples of sun.reflect.ReflectionFactory.newConstructorForSerialization()

        try {
            javaLangObjectConstructor = Object.class.getConstructor( (Class[]) null );
        } catch ( final NoSuchMethodException e ) {
            throw new Error( "Cannot find constructor for java.lang.Object!" );
        }
        this.mungedConstructor = reflectionFactory.newConstructorForSerialization( type,
                                                                              javaLangObjectConstructor );
        this.mungedConstructor.setAccessible( true );
    }

    public Object newInstance() {
View Full Code Here

Examples of sun.reflect.ReflectionFactory.newConstructorForSerialization()

   {
      try
      {
         Constructor<T> constructor;
         ReflectionFactory reflectionFactory = ReflectionFactory.getReflectionFactory();
         constructor = reflectionFactory.newConstructorForSerialization(proxyClass, Object.class.getDeclaredConstructor());
         return constructor;
      }
      catch (NoSuchMethodException e)
      {
         return null;
View Full Code Here

Examples of sun.reflect.ReflectionFactory.newConstructorForSerialization()

      try
      {
         Class<T> clazz = proxyFactory.createClass();
         ReflectionFactory reflectionFactory = ReflectionFactory.getReflectionFactory();
         Constructor<T> c = reflectionFactory.newConstructorForSerialization(clazz, Object.class.getDeclaredConstructor());
         T proxyObject = c.newInstance();
         ((ProxyObject)proxyObject).setHandler(interceptorMethodHandler);
         return proxyObject;
      } catch (Exception e)
      {
View Full Code Here

Examples of sun.reflect.ReflectionFactory.newConstructorForSerialization()

          *       constructor"
          */
         throw new ObjenesisException(new NotSerializableException(type+" has no suitable superclass constructor"));        
      }

      mungedConstructor = reflectionFactory.newConstructorForSerialization(type,
         nonSerializableAncestorConstructor);
      mungedConstructor.setAccessible(true);
   }

   public Object newInstance() {
View Full Code Here

Examples of sun.reflect.ReflectionFactory.newConstructorForSerialization()

         javaLangObjectConstructor = Object.class.getConstructor((Class[]) null);
      }
      catch(NoSuchMethodException e) {
         throw new Error("Cannot find constructor for java.lang.Object!");
      }
      mungedConstructor = reflectionFactory.newConstructorForSerialization(type,
         javaLangObjectConstructor);
      mungedConstructor.setAccessible(true);
   }

   public Object newInstance() {
View Full Code Here

Examples of sun.reflect.ReflectionFactory.newConstructorForSerialization()

          *       constructor"
          */
         throw new ObjenesisException(new NotSerializableException(type+" has no suitable superclass constructor"));        
      }

      mungedConstructor = reflectionFactory.newConstructorForSerialization(type,
         nonSerializableAncestorConstructor);
      mungedConstructor.setAccessible(true);
   }

   public Object newInstance() {
View Full Code Here

Examples of sun.reflect.ReflectionFactory.newConstructorForSerialization()

   public <T> T createProxyInstance(Class<T> proxyClass, MethodHandler interceptorMethodHandler)
   {
      try
      {
         ReflectionFactory reflectionFactory = ReflectionFactory.getReflectionFactory();
         Constructor<T> c = reflectionFactory.newConstructorForSerialization(proxyClass, Object.class.getDeclaredConstructor());
         T proxyObject = c.newInstance();
         if (interceptorMethodHandler != null)
         {
            ((ProxyObject) proxyObject).setHandler(interceptorMethodHandler);
         }
View Full Code Here

Examples of sun.reflect.ReflectionFactory.newConstructorForSerialization()

       *       or a "Exception in constructor"
       */
      throw new ObjenesisException(new NotSerializableException(type + " has no suitable superclass constructor"));
    }

    mungedConstructor = reflectionFactory.newConstructorForSerialization(type, nonSerializableAncestorConstructor);
    mungedConstructor.setAccessible(true);
  }

  public Object newInstance() {
    try {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.