Package org.objenesis

Examples of org.objenesis.ObjenesisException


      newInstanceMethod = getNewInstanceMethod();
      Method m = null;
      try {
         m = ObjectStreamClass.class.getMethod("lookupAny", Class.class);
      } catch (NoSuchMethodException e) {
         throw new ObjenesisException(e);
      }
      try {
         objectStreamClass = (ObjectStreamClass) m.invoke(null, type);
      } catch (IllegalAccessException e) {
         throw new ObjenesisException(e);
      } catch (InvocationTargetException e) {
         throw new ObjenesisException(e);
      }
   }
View Full Code Here


   public T newInstance() {
      try {
         return type.cast(newInstanceMethod.invoke(objectStreamClass, type));
      }
      catch(IllegalAccessException e) {
         throw new ObjenesisException(e);
      }
      catch(IllegalArgumentException e) {
         throw new ObjenesisException(e);
      }
      catch(InvocationTargetException e) {
         throw new ObjenesisException(e);
      }
   }
View Full Code Here

            "newInstance", Class.class);
         newInstanceMethod.setAccessible(true);
         return newInstanceMethod;
      }
      catch(RuntimeException e) {
         throw new ObjenesisException(e);
      }
      catch(NoSuchMethodException e) {
         throw new ObjenesisException(e);
      }
   }
View Full Code Here

      try {
         nonSerializableAncestorConstructor = nonSerializableAncestor
            .getConstructor((Class[]) null);
      }
      catch(NoSuchMethodException e) {
         throw new ObjenesisException(new NotSerializableException(type+" has no suitable superclass constructor"));        
      }

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

   public T newInstance() {
      try {
         return mungedConstructor.newInstance((Object[]) null);
      }
      catch(Exception e) {
         throw new ObjenesisException(e);
      }
   }
View Full Code Here

   public T newInstance() {
      try {
         return type.cast(newObjectMethod.invoke(dummyStream, type, Object.class));
      }
      catch(RuntimeException e) {
         throw new ObjenesisException(e);
      }
      catch(IllegalAccessException e) {
         throw new ObjenesisException(e);
      }
      catch(InvocationTargetException e) {
         throw new ObjenesisException(e);
      }
   }
View Full Code Here

   public T newInstance() {
      try {
         return type.cast(newInstanceMethod.invoke(null, type, objectConstructorId));
      }
      catch(Exception e) {
         throw new ObjenesisException(e);
      }
   }
View Full Code Here

            "newInstance", Class.class, Integer.TYPE);
         newInstanceMethod.setAccessible(true);
         return newInstanceMethod;
      }
      catch(RuntimeException e) {
         throw new ObjenesisException(e);
      }
      catch(NoSuchMethodException e) {
         throw new ObjenesisException(e);
      }
   }
View Full Code Here

    * @param type Class to instantiate
    * @return The ObjectInstantiator for the class
    */
   public <T> ObjectInstantiator<T> newInstantiatorOf(Class<T> type) {
      if(!Serializable.class.isAssignableFrom(type)) {
         throw new ObjenesisException(new NotSerializableException(type+" not serializable"));
      }
      if(JVM_NAME.startsWith(SUN) || PlatformDescription.isThisJVM(OPENJDK)) {
         return new ObjectStreamClassInstantiator<T>(type);
      }
      else if(JVM_NAME.startsWith(DALVIK)) {
View Full Code Here

         newInstanceMethod.setAccessible(true);

         return (Integer) newInstanceMethod.invoke(null, Object.class);
      }
      catch(RuntimeException e) {
         throw new ObjenesisException(e);
      }
      catch(NoSuchMethodException e) {
         throw new ObjenesisException(e);
      }
      catch(IllegalAccessException e) {
         throw new ObjenesisException(e);
      }
      catch(InvocationTargetException e) {
         throw new ObjenesisException(e);
      }
   }
View Full Code Here

TOP

Related Classes of org.objenesis.ObjenesisException

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.