Package org.objenesis

Interface Objenesis

    • Method Detail

      • newInstance

        <T> T newInstance​(java.lang.Class<T> clazz)
        Will create a new object without any constructor being called
        Type Parameters:
        T - Type instantiated
        Parameters:
        clazz - Class to instantiate
        Returns:
        New instance of clazz
      • getInstantiatorOf

        <T> ObjectInstantiator<T> getInstantiatorOf​(java.lang.Class<T> clazz)
        Will pick the best instantiator for the provided class. If you need to create a lot of instances from the same class, it is way more efficient to create them from the same ObjectInstantiator than calling newInstance(Class).
        Type Parameters:
        T - Type to instantiate
        Parameters:
        clazz - Class to instantiate
        Returns:
        Instantiator dedicated to the class