Top Description Fields Constructors Methods
org.objenesis.instantiator.sun

public Class UnsafeFactoryInstantiator<T>

extends Object
implements ObjectInstantiator<T>
Class Inheritance
All Implemented Interfaces
org.objenesis.instantiator.ObjectInstantiator
Annotations
@SuppressWarnings:restriction
@Instantiator:STANDARD
Imports
sun.misc.Unsafe, org.objenesis.ObjenesisException, org.objenesis.instantiator.ObjectInstantiator, org.objenesis.instantiator.annotations.Instantiator, .Typology, org.objenesis.instantiator.util.UnsafeUtils

Instantiates an object, WITHOUT calling its constructor, using sun.misc.Unsafe.allocateInstance(). Unsafe and its methods are implemented by most modern JVMs.
Author
Henri Tremblay
See Also
ObjectInstantiator

Field Summary

Modifier and TypeField and Description
private final Class<T>
private final sun.misc.Unsafe

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public T
newInstance()

Implements org.objenesis.instantiator.ObjectInstantiator.newInstance.

Returns a new instance of an object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

typeback to summary
private final Class<T> type
unsafeback to summary
private final sun.misc.Unsafe unsafe

Constructor Detail

UnsafeFactoryInstantiatorback to summary
public UnsafeFactoryInstantiator(Class<T> type)

Method Detail

newInstanceback to summary
public T newInstance()

Implements org.objenesis.instantiator.ObjectInstantiator.newInstance.

Doc from org.objenesis.instantiator.ObjectInstantiator.newInstance.

Returns a new instance of an object. The returned object's class is defined by the implementation.

Returns:T

A new instance of an object.