@Instantiator(value=STANDARD) public class MagicInstantiator<T> extends java.lang.Object implements ObjectInstantiator<T>
MagicAccessorImpl
which prevents
its children to be verified by the class loaderModifier and Type | Field and Description |
---|---|
private static int |
CONSTANT_POOL_COUNT |
private static byte[] |
CONSTRUCTOR_CODE |
private static int |
CONSTRUCTOR_CODE_ATTRIBUTE_LENGTH |
private static java.lang.String |
CONSTRUCTOR_DESC |
private static java.lang.String |
CONSTRUCTOR_NAME |
private static int |
INDEX_CLASS_INTERFACE |
private static int |
INDEX_CLASS_OBJECT |
private static int |
INDEX_CLASS_SUPERCLASS |
private static int |
INDEX_CLASS_THIS |
private static int |
INDEX_CLASS_TYPE |
private static int |
INDEX_METHODREF_OBJECT_CONSTRUCTOR |
private static int |
INDEX_NAMEANDTYPE_DEFAULT_CONSTRUCTOR |
private static int |
INDEX_UTF8_CODE_ATTRIBUTE |
private static int |
INDEX_UTF8_CONSTRUCTOR_DESC |
private static int |
INDEX_UTF8_CONSTRUCTOR_NAME |
private static int |
INDEX_UTF8_INSTANTIATOR_CLASS |
private static int |
INDEX_UTF8_INTERFACE |
private static int |
INDEX_UTF8_NEWINSTANCE_DESC |
private static int |
INDEX_UTF8_NEWINSTANCE_NAME |
private static int |
INDEX_UTF8_OBJECT |
private static int |
INDEX_UTF8_SUPERCLASS |
private static int |
INDEX_UTF8_TYPE |
private ObjectInstantiator<T> |
instantiator |
private static java.lang.String |
MAGIC_ACCESSOR |
private static byte[] |
NEWINSTANCE_CODE |
private static int |
NEWINSTANCE_CODE_ATTRIBUTE_LENGTH |
Constructor and Description |
---|
MagicInstantiator(java.lang.Class<T> type) |
Modifier and Type | Method and Description |
---|---|
ObjectInstantiator<T> |
getInstantiator()
Get the underlying instantiator.
|
private static java.lang.String |
getMagicClass() |
T |
newInstance()
Returns a new instance of an object.
|
private <T> ObjectInstantiator<T> |
newInstantiatorOf(java.lang.Class<T> type) |
private byte[] |
writeExtendingClass(java.lang.Class<?> type,
java.lang.String className)
Will generate the bytes for a class extending the type passed in parameter.
|
private static final java.lang.String MAGIC_ACCESSOR
private static final int INDEX_CLASS_THIS
private static final int INDEX_CLASS_SUPERCLASS
private static final int INDEX_UTF8_CONSTRUCTOR_NAME
private static final int INDEX_UTF8_CONSTRUCTOR_DESC
private static final int INDEX_UTF8_CODE_ATTRIBUTE
private static final int INDEX_UTF8_INSTANTIATOR_CLASS
private static final int INDEX_UTF8_SUPERCLASS
private static final int INDEX_CLASS_INTERFACE
private static final int INDEX_UTF8_INTERFACE
private static final int INDEX_UTF8_NEWINSTANCE_NAME
private static final int INDEX_UTF8_NEWINSTANCE_DESC
private static final int INDEX_METHODREF_OBJECT_CONSTRUCTOR
private static final int INDEX_CLASS_OBJECT
private static final int INDEX_UTF8_OBJECT
private static final int INDEX_NAMEANDTYPE_DEFAULT_CONSTRUCTOR
private static final int INDEX_CLASS_TYPE
private static final int INDEX_UTF8_TYPE
private static int CONSTANT_POOL_COUNT
private static final byte[] CONSTRUCTOR_CODE
private static final int CONSTRUCTOR_CODE_ATTRIBUTE_LENGTH
private static final byte[] NEWINSTANCE_CODE
private static final int NEWINSTANCE_CODE_ATTRIBUTE_LENGTH
private static final java.lang.String CONSTRUCTOR_NAME
private static final java.lang.String CONSTRUCTOR_DESC
private ObjectInstantiator<T> instantiator
public MagicInstantiator(java.lang.Class<T> type)
public ObjectInstantiator<T> getInstantiator()
MagicInstantiator
is a wrapper around another object
which implements ObjectInstantiator
interface.
This method exposes that instantiator.private <T> ObjectInstantiator<T> newInstantiatorOf(java.lang.Class<T> type)
private byte[] writeExtendingClass(java.lang.Class<?> type, java.lang.String className)
type
- type to extendclassName
- name of the wrapped instantiator classObjenesisException
- is something goes wrongpublic T newInstance()
ObjectInstantiator
newInstance
in interface ObjectInstantiator<T>
private static java.lang.String getMagicClass()