Package org.jdrupes.vmoperator.common
Class DynamicTypeAdapterFactory<O extends K8sDynamicModel,L extends K8sDynamicModelsBase<O>>
java.lang.Object
org.jdrupes.vmoperator.common.DynamicTypeAdapterFactory<O,L>
- Type Parameters:
O
- the generic typeL
- the generic type
- All Implemented Interfaces:
com.google.gson.TypeAdapterFactory
- Direct Known Subclasses:
K8sDynamicStub.K8sDynamicModelTypeAdapterFactory
,VmDefinitionStub.VmDefintionModelTypeAdapterFactory
public class DynamicTypeAdapterFactory<O extends K8sDynamicModel,L extends K8sDynamicModelsBase<O>>
extends Object
implements com.google.gson.TypeAdapterFactory
A factory for creating objects.
-
Constructor Summary
ConstructorDescriptionDynamicTypeAdapterFactory
(Class<O> objectClass, Class<L> objectListClass) Instantiates a new generic type adapter factory. -
Method Summary
Modifier and TypeMethodDescription<T> com.google.gson.TypeAdapter
<T> create
(com.google.gson.Gson gson, com.google.gson.reflect.TypeToken<T> typeToken) Creates a type adapter for the given type.void
register
(io.kubernetes.client.openapi.ApiClient client) Make sure that this adapter is registered.
-
Constructor Details
-
DynamicTypeAdapterFactory
Instantiates a new generic type adapter factory.- Parameters:
objectClass
- the object classobjectListClass
- the object list class
-
-
Method Details
-
register
Make sure that this adapter is registered.- Parameters:
client
- the client
-
create
public <T> com.google.gson.TypeAdapter<T> create(com.google.gson.Gson gson, com.google.gson.reflect.TypeToken<T> typeToken) Creates a type adapter for the given type.- Specified by:
create
in interfacecom.google.gson.TypeAdapterFactory
- Type Parameters:
T
- the generic type- Parameters:
gson
- the gsontypeToken
- the type token- Returns:
- the type adapter or null if the type is not handles by this factory
-