com.google.gson.internal.ObjectConstructor Java Examples
The following examples show how to use
com.google.gson.internal.ObjectConstructor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CollectionTypeAdapterFactory.java From framework with GNU Affero General Public License v3.0 | 6 votes |
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) { Type type = typeToken.getType(); Class<? super T> rawType = typeToken.getRawType(); if (!Collection.class.isAssignableFrom(rawType)) { return null; } Type elementType = $Gson$Types.getCollectionElementType(type, rawType); TypeAdapter<?> elementTypeAdapter = gson.getAdapter(TypeToken.get(elementType)); ObjectConstructor<T> constructor = constructorConstructor.get(typeToken); @SuppressWarnings({"unchecked", "rawtypes"}) // create() doesn't define a type parameter TypeAdapter<T> result = new Adapter(gson, elementType, elementTypeAdapter, constructor); return result; }
Example #2
Source File: MapTypeAdapterFactory.java From gson with Apache License 2.0 | 6 votes |
@Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) { Type type = typeToken.getType(); Class<? super T> rawType = typeToken.getRawType(); if (!Map.class.isAssignableFrom(rawType)) { return null; } Class<?> rawTypeOfSrc = $Gson$Types.getRawType(type); Type[] keyAndValueTypes = $Gson$Types.getMapKeyAndValueTypes(type, rawTypeOfSrc); TypeAdapter<?> keyAdapter = getKeyAdapter(gson, keyAndValueTypes[0]); TypeAdapter<?> valueAdapter = gson.getAdapter(TypeToken.get(keyAndValueTypes[1])); ObjectConstructor<T> constructor = constructorConstructor.get(typeToken); @SuppressWarnings({"unchecked", "rawtypes"}) // we don't define a type parameter for the key or value types TypeAdapter<T> result = new Adapter(gson, keyAndValueTypes[0], keyAdapter, keyAndValueTypes[1], valueAdapter, constructor); return result; }
Example #3
Source File: CollectionTypeAdapterFactory.java From gson with Apache License 2.0 | 6 votes |
@Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) { Type type = typeToken.getType(); Class<? super T> rawType = typeToken.getRawType(); if (!Collection.class.isAssignableFrom(rawType)) { return null; } Type elementType = $Gson$Types.getCollectionElementType(type, rawType); TypeAdapter<?> elementTypeAdapter = gson.getAdapter(TypeToken.get(elementType)); ObjectConstructor<T> constructor = constructorConstructor.get(typeToken); @SuppressWarnings({"unchecked", "rawtypes"}) // create() doesn't define a type parameter TypeAdapter<T> result = new Adapter(gson, elementType, elementTypeAdapter, constructor); return result; }
Example #4
Source File: CollectionTypeAdapterFactory.java From salt-netapi-client with MIT License | 6 votes |
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) { Type type = typeToken.getType(); Class<? super T> rawType = typeToken.getRawType(); if (!Collection.class.isAssignableFrom(rawType)) { return null; } Type elementType = $Gson$Types.getCollectionElementType(type, rawType); TypeAdapter<?> elementTypeAdapter = gson.getAdapter(TypeToken.get(elementType)); ObjectConstructor<T> constructor = constructorConstructor.get(typeToken); @SuppressWarnings({ "unchecked", "rawtypes" }) TypeAdapter<T> result = new Adapter(elementTypeAdapter, constructor); return result; }
Example #5
Source File: MapTypeAdapterFactory.java From framework with GNU Affero General Public License v3.0 | 6 votes |
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) { Type type = typeToken.getType(); Class<? super T> rawType = typeToken.getRawType(); if (!Map.class.isAssignableFrom(rawType)) { return null; } Class<?> rawTypeOfSrc = $Gson$Types.getRawType(type); Type[] keyAndValueTypes = $Gson$Types.getMapKeyAndValueTypes(type, rawTypeOfSrc); TypeAdapter<?> keyAdapter = getKeyAdapter(gson, keyAndValueTypes[0]); TypeAdapter<?> valueAdapter = gson.getAdapter(TypeToken.get(keyAndValueTypes[1])); ObjectConstructor<T> constructor = constructorConstructor.get(typeToken); @SuppressWarnings({"unchecked", "rawtypes"}) // we don't define a type parameter for the key or value types TypeAdapter<T> result = new Adapter(gson, keyAndValueTypes[0], keyAdapter, keyAndValueTypes[1], valueAdapter, constructor); return result; }
Example #6
Source File: ReflectiveTypeAdapterFactory.java From framework with GNU Affero General Public License v3.0 | 5 votes |
public <T> TypeAdapter<T> create(Gson gson, final TypeToken<T> type) { Class<? super T> raw = type.getRawType(); if (!Object.class.isAssignableFrom(raw)) { return null; // it's a primitive! } ObjectConstructor<T> constructor = constructorConstructor.get(type); return new Adapter<T>(constructor, getBoundFields(gson, type, raw)); }
Example #7
Source File: LaReflectiveTypeAdapterFactory.java From lastaflute with Apache License 2.0 | 5 votes |
@Override public <T> TypeAdapter<T> create(Gson gson, final TypeToken<T> type) { final Class<? super T> raw = type.getRawType(); if (!Object.class.isAssignableFrom(raw)) { return null; // it's a primitive! } final ObjectConstructor<T> constructor = constructorConstructor.get(type); return new ReflextiveAdapter<T>(constructor, getBoundFields(gson, type, raw)); }
Example #8
Source File: CollectionTypeAdapterFactory.java From framework with GNU Affero General Public License v3.0 | 5 votes |
public Adapter(Gson context, Type elementType, TypeAdapter<E> elementTypeAdapter, ObjectConstructor<? extends Collection<E>> constructor) { this.elementTypeAdapter = new TypeAdapterRuntimeTypeWrapper<E>(context, elementTypeAdapter, elementType); this.constructor = constructor; }
Example #9
Source File: f.java From MiBandDecompiled with Apache License 2.0 | 5 votes |
public f(MapTypeAdapterFactory maptypeadapterfactory, Gson gson, Type type, TypeAdapter typeadapter, Type type1, TypeAdapter typeadapter1, ObjectConstructor objectconstructor) { a = maptypeadapterfactory; super(); b = new m(gson, typeadapter, type); c = new m(gson, typeadapter1, type1); d = objectconstructor; }
Example #10
Source File: MapTypeAdapterFactory.java From gson with Apache License 2.0 | 5 votes |
public Adapter(Gson context, Type keyType, TypeAdapter<K> keyTypeAdapter, Type valueType, TypeAdapter<V> valueTypeAdapter, ObjectConstructor<? extends Map<K, V>> constructor) { this.keyTypeAdapter = new TypeAdapterRuntimeTypeWrapper<K>(context, keyTypeAdapter, keyType); this.valueTypeAdapter = new TypeAdapterRuntimeTypeWrapper<V>(context, valueTypeAdapter, valueType); this.constructor = constructor; }
Example #11
Source File: CollectionTypeAdapterFactory.java From gson with Apache License 2.0 | 5 votes |
public Adapter(Gson context, Type elementType, TypeAdapter<E> elementTypeAdapter, ObjectConstructor<? extends Collection<E>> constructor) { this.elementTypeAdapter = new TypeAdapterRuntimeTypeWrapper<E>(context, elementTypeAdapter, elementType); this.constructor = constructor; }
Example #12
Source File: ReflectiveTypeAdapterFactory.java From gson with Apache License 2.0 | 5 votes |
@Override public <T> TypeAdapter<T> create(Gson gson, final TypeToken<T> type) { Class<? super T> raw = type.getRawType(); if (!Object.class.isAssignableFrom(raw)) { return null; // it's a primitive! } ObjectConstructor<T> constructor = constructorConstructor.get(type); return new Adapter<T>(constructor, getBoundFields(gson, type, raw)); }
Example #13
Source File: MapTypeAdapterFactory.java From framework with GNU Affero General Public License v3.0 | 5 votes |
public Adapter(Gson context, Type keyType, TypeAdapter<K> keyTypeAdapter, Type valueType, TypeAdapter<V> valueTypeAdapter, ObjectConstructor<? extends Map<K, V>> constructor) { this.keyTypeAdapter = new TypeAdapterRuntimeTypeWrapper<K>(context, keyTypeAdapter, keyType); this.valueTypeAdapter = new TypeAdapterRuntimeTypeWrapper<V>(context, valueTypeAdapter, valueType); this.constructor = constructor; }
Example #14
Source File: ReflectiveTypeAdapterFactory.java From framework with GNU Affero General Public License v3.0 | 4 votes |
private Adapter(ObjectConstructor<T> constructor, Map<String, BoundField> boundFields) { this.constructor = constructor; this.boundFields = boundFields; }
Example #15
Source File: MapTypeAdapterFactory.java From letv with Apache License 2.0 | 4 votes |
public Adapter(Gson context, Type keyType, TypeAdapter<K> keyTypeAdapter, Type valueType, TypeAdapter<V> valueTypeAdapter, ObjectConstructor<? extends Map<K, V>> constructor) { this.keyTypeAdapter = new TypeAdapterRuntimeTypeWrapper(context, keyTypeAdapter, keyType); this.valueTypeAdapter = new TypeAdapterRuntimeTypeWrapper(context, valueTypeAdapter, valueType); this.constructor = constructor; }
Example #16
Source File: CollectionTypeAdapterFactory.java From salt-netapi-client with MIT License | 4 votes |
public Adapter(TypeAdapter<E> elementAdapter, ObjectConstructor<? extends Collection<E>> constructor) { this.constructor = constructor; this.elementTypeAdapter = elementAdapter; }
Example #17
Source File: ReflectiveTypeAdapterFactory.java From gson with Apache License 2.0 | 4 votes |
Adapter(ObjectConstructor<T> constructor, Map<String, BoundField> boundFields) { this.constructor = constructor; this.boundFields = boundFields; }
Example #18
Source File: b.java From MiBandDecompiled with Apache License 2.0 | 4 votes |
public b(Gson gson, Type type, TypeAdapter typeadapter, ObjectConstructor objectconstructor) { a = new m(gson, typeadapter, type); b = objectconstructor; }
Example #19
Source File: LaReflectiveTypeAdapterFactory.java From lastaflute with Apache License 2.0 | 4 votes |
protected ReflextiveAdapter(ObjectConstructor<PROPERTY> constructor, Map<String, LaBoundField> boundFields) { this.constructor = constructor; this.boundFields = boundFields; }
Example #20
Source File: ReflectiveTypeAdapterFactory.java From letv with Apache License 2.0 | 4 votes |
private Adapter(ObjectConstructor<T> constructor, Map<String, BoundField> boundFields) { this.constructor = constructor; this.boundFields = boundFields; }
Example #21
Source File: CollectionTypeAdapterFactory.java From letv with Apache License 2.0 | 4 votes |
public Adapter(Gson context, Type elementType, TypeAdapter<E> elementTypeAdapter, ObjectConstructor<? extends Collection<E>> constructor) { this.elementTypeAdapter = new TypeAdapterRuntimeTypeWrapper(context, elementTypeAdapter, elementType); this.constructor = constructor; }