Package com.google.gson.internal
Class ConstructorConstructor.ThrowingObjectConstructor<T>
java.lang.Object
com.google.gson.internal.ConstructorConstructor.ThrowingObjectConstructor<T>
- All Implemented Interfaces:
ObjectConstructor<T>
- Enclosing class:
- ConstructorConstructor
private static final class ConstructorConstructor.ThrowingObjectConstructor<T>
extends Object
implements ObjectConstructor<T>
ObjectConstructor which always throws an exception.
This keeps backward compatibility, compared to using a null
ObjectConstructor, which would then choose another way of creating the object. And it supports
types which are only serialized but not deserialized (compared to directly throwing an
exception when the ObjectConstructor is requested), e.g. when the runtime type of an
object is inaccessible, but the compile-time type is accessible.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
exceptionMessage
-
-
Constructor Details
-
ThrowingObjectConstructor
ThrowingObjectConstructor(String exceptionMessage)
-
-
Method Details
-
construct
Description copied from interface:ObjectConstructorReturns a new instance.- Specified by:
constructin interfaceObjectConstructor<T>
-