Package org.objenesis.instantiator.sun
Class MagicInstantiator<T>
- java.lang.Object
-
- org.objenesis.instantiator.sun.MagicInstantiator<T>
-
- All Implemented Interfaces:
ObjectInstantiator<T>
@Instantiator(STANDARD) public class MagicInstantiator<T> extends java.lang.Object implements 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 extendingMagicAccessorImpl
which prevents its children to be verified by the class loader
-
-
Constructor Summary
Constructors Constructor Description MagicInstantiator(java.lang.Class<T> type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectInstantiator<T>
getInstantiator()
Get the underlying instantiator.T
newInstance()
Returns a new instance of an object.
-
-
-
Constructor Detail
-
MagicInstantiator
public MagicInstantiator(java.lang.Class<T> type)
-
-
Method Detail
-
getInstantiator
public ObjectInstantiator<T> getInstantiator()
Get the underlying instantiator.MagicInstantiator
is a wrapper around another object which implementsObjectInstantiator
interface. This method exposes that instantiator.- Returns:
- the underlying instantiator
-
newInstance
public T newInstance()
Description copied from interface:ObjectInstantiator
Returns a new instance of an object. The returned object's class is defined by the implementation.- Specified by:
newInstance
in interfaceObjectInstantiator<T>
- Returns:
- A new instance of an object.
-
-