Class MagicInstantiator<T>

  • All Implemented Interfaces:
    org.objenesis.instantiator.ObjectInstantiator<T>

    @Instantiator(STANDARD)
    public class MagicInstantiator<T>
    extends java.lang.Object
    implements org.objenesis.instantiator.ObjectInstantiator<T>
    This instantiator will correctly bypass the constructors by instantiating the class using the default constructor from Object. It will be allowed to do so by extending MagicAccessorImpl which prevents its children to be verified by the class loader
    Author:
    Henri Tremblay
    • Constructor Summary

      Constructors 
      Constructor Description
      MagicInstantiator​(java.lang.Class<T> type)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.objenesis.instantiator.ObjectInstantiator<T> getInstantiator()
      Get the underlying instantiator.
      T newInstance()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MagicInstantiator

        public MagicInstantiator​(java.lang.Class<T> type)
    • Method Detail

      • getInstantiator

        public org.objenesis.instantiator.ObjectInstantiator<T> getInstantiator()
        Get the underlying instantiator. MagicInstantiator is a wrapper around another object which implements ObjectInstantiator interface. This method exposes that instantiator.
        Returns:
        the underlying instantiator
      • newInstance

        public T newInstance()
        Specified by:
        newInstance in interface org.objenesis.instantiator.ObjectInstantiator<T>