| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private static class | ConstructorConstructor.
|
| Modifier and Type | Field and Description |
|---|---|
| private final Map | |
| private final List | |
| private final boolean |
| Access | Constructor and Description |
|---|---|
| public | ConstructorConstructor(Map<Type, InstanceCreator<?>> instanceCreators, boolean useJdkUnsafe, List<ReflectionAccessFilter> reflectionFilters)
|
| Modifier and Type | Method and Description |
|---|---|
| pack-priv static String | Returns: if instantiablenull, else a non-null exception messageinstance of the class to be checked c)Check if the class can be instantiated by Unsafe allocator. |
| public <T> ObjectConstructor | |
| public <T> ObjectConstructor | get(TypeToken<T>
type for which a constructor should be retrieved typeToken, boolean whether to allow usage of JDK Unsafe; has no effect if allowUnsafe)useJdkUnsafe
is falseRetrieves an object constructor for the given type. |
| private static boolean | |
| private static ObjectConstructor | |
| private static <T> ObjectConstructor | |
| private static <T> ObjectConstructor | newDefaultImplementationConstructor(Type type, Class<? super T> rawType)
Constructors for common interface types like Map and List and their subtypes. |
| private static ObjectConstructor | |
| private static <T> ObjectConstructor | newSpecialCollectionConstructor(Type type, Class<? super T> rawType)
Creates constructors for special JDK collection types which do not have a public no-args constructor. |
| private <T> ObjectConstructor | |
| public String |
| instanceCreators | back to summary |
|---|---|
| private final Map<Type, InstanceCreator<?>> instanceCreators | |
| reflectionFilters | back to summary |
|---|---|
| private final List<ReflectionAccessFilter> reflectionFilters | |
| useJdkUnsafe | back to summary |
|---|---|
| private final boolean useJdkUnsafe | |
| ConstructorConstructor | back to summary |
|---|---|
| public ConstructorConstructor(Map<Type, InstanceCreator<?>> instanceCreators, boolean useJdkUnsafe, List<ReflectionAccessFilter> reflectionFilters) | |
| checkInstantiable | back to summary |
|---|---|
| pack-priv static String checkInstantiable(Class<?> c) Check if the class can be instantiated by Unsafe allocator. If the instance has interface or abstract modifiers return an exception message. | |
| get | back to summary |
|---|---|
| public <T> ObjectConstructor Calls | |
| get | back to summary |
|---|---|
| public <T> ObjectConstructor Retrieves an object constructor for the given type.
| |
| hasStringKeyType | back to summary |
|---|---|
| private static boolean hasStringKeyType(Type mapType) | |
| newCollectionConstructor | back to summary |
|---|---|
| private static ObjectConstructor | |
| newDefaultConstructor | back to summary |
|---|---|
| private static <T> ObjectConstructor | |
| newDefaultImplementationConstructor | back to summary |
|---|---|
| private static <T> ObjectConstructor Constructors for common interface types like Map and List and their subtypes. | |
| newMapConstructor | back to summary |
|---|---|
| private static ObjectConstructor | |
| newSpecialCollectionConstructor | back to summary |
|---|---|
| private static <T> ObjectConstructor Creates constructors for special JDK collection types which do not have a public no-args constructor. | |
| newUnsafeAllocator | back to summary |
|---|---|
| private <T> ObjectConstructor | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |
| Modifier and Type | Field and Description |
|---|---|
| private final InstanceCreator | |
| private final Type |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public T |
| instanceCreator | back to summary |
|---|---|
| private final InstanceCreator<T> instanceCreator | |
| type | back to summary |
|---|---|
| private final Type type | |
| InstanceCreatorConstructor | back to summary |
|---|---|
| pack-priv InstanceCreatorConstructor(InstanceCreator<T> instanceCreator, Type type) | |
| construct | back to summary |
|---|---|
| public T construct() Implements com. Doc from com. Returns a new instance.
| |
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.
| Modifier and Type | Field and Description |
|---|---|
| private final String |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public T |
| exceptionMessage | back to summary |
|---|---|
| private final String exceptionMessage | |
| ThrowingObjectConstructor | back to summary |
|---|---|
| pack-priv ThrowingObjectConstructor(String exceptionMessage) | |
| construct | back to summary |
|---|---|
| public T construct() Implements com. Doc from com. Returns a new instance.
| |