Package com.suse.salt.netapi.parser
Class CollectionTypeAdapterFactory
java.lang.Object
com.suse.salt.netapi.parser.CollectionTypeAdapterFactory
- All Implemented Interfaces:
com.google.gson.TypeAdapterFactory
public class CollectionTypeAdapterFactory
extends Object
implements com.google.gson.TypeAdapterFactory
Adapt a homogeneous collection of objects.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classAdapter for the Collections. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static TypecollectionElementType(Type type) Returns the element type of a Collection parameterized type.private static Supplier<Collection<?>> collectionSupplier(Class<?> rawType) Returns aSupplierthat creates a suitable mutableCollectioninstance for the given raw collection type.<T> com.google.gson.TypeAdapter<T> create(com.google.gson.Gson gson, com.google.gson.reflect.TypeToken<T> typeToken)
-
Constructor Details
-
CollectionTypeAdapterFactory
public CollectionTypeAdapterFactory()
-
-
Method Details
-
create
public <T> com.google.gson.TypeAdapter<T> create(com.google.gson.Gson gson, com.google.gson.reflect.TypeToken<T> typeToken) - Specified by:
createin interfacecom.google.gson.TypeAdapterFactory
-
collectionElementType
Returns the element type of a Collection parameterized type. Handles wildcard upper bounds (e.g.Collection<? extends Foo>). -
collectionSupplier
Returns aSupplierthat creates a suitable mutableCollectioninstance for the given raw collection type.
-