Package com.google.gson.internal
Class UnsafeAllocator
java.lang.Object
com.google.gson.internal.UnsafeAllocator
Do sneaky things to allocate objects without invoking their constructors.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static void
assertInstantiable
(Class<?> c) Check if the class can be instantiated by unsafe allocator.static UnsafeAllocator
create()
abstract <T> T
newInstance
(Class<T> c)
-
Constructor Details
-
UnsafeAllocator
public UnsafeAllocator()
-
-
Method Details
-
newInstance
- Throws:
Exception
-
create
-
assertInstantiable
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
-