Package org.objenesis

Examples of org.objenesis.ObjenesisStd


  private boolean                      dumpClonedClasses  = false;
  private boolean                      cloningEnabled    = true;

  public Cloner()
  {
    objenesis = new ObjenesisStd();
    init();
  }
View Full Code Here


public class CustomMorphiaObjectFactory extends DefaultCreator {
    private ClassLoader classloader;
    private Objenesis objenesis;

    public CustomMorphiaObjectFactory(ClassLoader classloader){
        objenesis = new ObjenesisStd();
        this.classloader = classloader;
    }
View Full Code Here

  public static Object instantiate(String json) {
    return null;
  }
 
  public static Object instantiate(Class< ? > clazz) {
    Objenesis objenesis = new ObjenesisStd();
    ObjectInstantiator thingyInstantiator = objenesis.getInstantiatorOf(clazz);
    return thingyInstantiator.newInstance();
  }
View Full Code Here

    }
    return null;
  }
 
  public static Object instantiate(Class< ? > clazz) {
    Objenesis objenesis = new ObjenesisStd();
    ObjectInstantiator thingyInstantiator = objenesis.getInstantiatorOf(clazz);
    return thingyInstantiator.newInstance();
  }
View Full Code Here

   * @return A new instance of type T, created without invoking the
   *         constructor.
   */
  @SuppressWarnings("unchecked")
  public static <T> T newInstance(Class<T> classToInstantiate) {
    Objenesis objenesis = new ObjenesisStd();
    ObjectInstantiator thingyInstantiator = objenesis.getInstantiatorOf(classToInstantiate);
    return (T) thingyInstantiator.newInstance();
  }
View Full Code Here

        Enhancer.registerCallbacks(proxiedClass, new Callback[] { interceptor });
        /* To make the proxy creator work with Eclipse plugins */
    enhancer.setClassLoader(ProxyCreator.class.getClassLoader());

    // Instantiate the proxied class
    Objenesis objenesis = new ObjenesisStd();
    proxy = objenesis.newInstance(proxiedClass);
    return proxy;
  }
View Full Code Here

      when(mockedUser.getId()).thenReturn("fcamblor");
     
    // Mocking Hudson singleton instance ...
      // Warning : this line will only work on Objenesis supported VMs :
      // http://code.google.com/p/objenesis/wiki/ListOfCurrentlySupportedVMs
      Hudson hudsonMockedInstance = spy((Hudson) new ObjenesisStd().getInstantiatorOf(Hudson.class).newInstance());
    PowerMockito.doReturn(currentHudsonRootDirectory).when(hudsonMockedInstance).getRootDir();
    PowerMockito.doReturn(mockedUser).when(hudsonMockedInstance).getMe();
    PowerMockito.doReturn(scmSyncConfigPluginInstance).when(hudsonMockedInstance).getPlugin(ScmSyncConfigurationPlugin.class);
   
      PowerMockito.mockStatic(Hudson.class);
View Full Code Here

public class ObjenesisInstanceCreator
  implements InstanceCreator {

  @SuppressWarnings("unchecked")
  public <T> T instanceFor(Class<T> clazz) {
  return (T) new ObjenesisStd().newInstance(clazz);
  }
View Full Code Here

    private final Set<Class<?>> ignoredClasses = new HashSet<Class<?>>();
    private final Map<Object, Boolean> ignoredInstances = new IdentityHashMap<Object, Boolean>();
    private final ConcurrentHashMap<Class<?>, List<Field>> fieldsMap = new ConcurrentHashMap<Class<?>, List<Field>>();

    public ObjectCloner() {
        objenesis = new ObjenesisStd();
        init();
    }
View Full Code Here

                } else if (l.getAttributes().getNamedItem( ATTRIBUTE_NAME ).getNodeValue().equals( JCL_SYSTEM )) {
                    processLoader( jcl.getSystemLoader(), l );
                } else if (l.getAttributes().getNamedItem( ATTRIBUTE_NAME ).getNodeValue().equals( JCL_BOOTOSGI )) {
                    processLoader( jcl.getOsgiBootLoader(), l );
                } else {
                    Objenesis objenesis = new ObjenesisStd();

                    Class<?> clazz = null;
                    try {
                        clazz = getClass().getClassLoader().loadClass(
                                l.getAttributes().getNamedItem( ATTRIBUTE_CLASS ).getNodeValue() );
                    } catch (Exception e) {
                        throw new JclContextException( e );
                    }

                    ProxyClassLoader pcl = (ProxyClassLoader) objenesis.newInstance( clazz );
                    jcl.addLoader( pcl );

                    processLoader( pcl, l );
                }
            }
View Full Code Here

TOP

Related Classes of org.objenesis.ObjenesisStd

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.