- java.lang.Object
-
- com.google.gson.internal.UnsafeAllocator
-
public abstract class UnsafeAllocator extends java.lang.ObjectDo sneaky things to allocate objects without invoking their constructors.
-
-
Constructor Summary
Constructors Constructor Description UnsafeAllocator()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) static voidassertInstantiable(java.lang.Class<?> c)Check if the class can be instantiated by unsafe allocator.static UnsafeAllocatorcreate()abstract <T> TnewInstance(java.lang.Class<T> c)
-
-
-
Method Detail
-
newInstance
public abstract <T> T newInstance(java.lang.Class<T> c) throws java.lang.Exception- Throws:
java.lang.Exception
-
create
public static UnsafeAllocator create()
-
assertInstantiable
static void assertInstantiable(java.lang.Class<?> c)
Check if the class can be instantiated by unsafe allocator. If the instance has interface or abstract modifiers throw anUnsupportedOperationException- Parameters:
c- instance of the class to be checked
-
-