com.google.gson.internal.ObjectConstructor源码实例Demo

类com.google.gson.internal.ObjectConstructor源码实例Demo

下面列出了com.google.gson.internal.ObjectConstructor 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: gson   文件: MapTypeAdapterFactory.java
@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;
}
 
源代码2 项目: gson   文件: CollectionTypeAdapterFactory.java
@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;
}
 
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;
}
 
源代码4 项目: framework   文件: MapTypeAdapterFactory.java
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;
}
 
源代码5 项目: framework   文件: CollectionTypeAdapterFactory.java
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;
}
 
@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));
}
 
源代码7 项目: MiBandDecompiled   文件: f.java
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;
}
 
源代码8 项目: gson   文件: MapTypeAdapterFactory.java
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;
}
 
源代码9 项目: gson   文件: CollectionTypeAdapterFactory.java
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;
}
 
源代码10 项目: gson   文件: ReflectiveTypeAdapterFactory.java
@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));
}
 
源代码11 项目: framework   文件: MapTypeAdapterFactory.java
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;
}
 
源代码12 项目: framework   文件: CollectionTypeAdapterFactory.java
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;
}
 
源代码13 项目: framework   文件: ReflectiveTypeAdapterFactory.java
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));
}
 
源代码14 项目: letv   文件: MapTypeAdapterFactory.java
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;
}
 
源代码15 项目: letv   文件: CollectionTypeAdapterFactory.java
public Adapter(Gson context, Type elementType, TypeAdapter<E> elementTypeAdapter, ObjectConstructor<? extends Collection<E>> constructor) {
    this.elementTypeAdapter = new TypeAdapterRuntimeTypeWrapper(context, elementTypeAdapter, elementType);
    this.constructor = constructor;
}
 
源代码16 项目: letv   文件: ReflectiveTypeAdapterFactory.java
private Adapter(ObjectConstructor<T> constructor, Map<String, BoundField> boundFields) {
    this.constructor = constructor;
    this.boundFields = boundFields;
}
 
protected ReflextiveAdapter(ObjectConstructor<PROPERTY> constructor, Map<String, LaBoundField> boundFields) {
    this.constructor = constructor;
    this.boundFields = boundFields;
}
 
源代码18 项目: MiBandDecompiled   文件: b.java
public b(Gson gson, Type type, TypeAdapter typeadapter, ObjectConstructor objectconstructor)
{
    a = new m(gson, typeadapter, type);
    b = objectconstructor;
}
 
源代码19 项目: gson   文件: ReflectiveTypeAdapterFactory.java
Adapter(ObjectConstructor<T> constructor, Map<String, BoundField> boundFields) {
  this.constructor = constructor;
  this.boundFields = boundFields;
}
 
public Adapter(TypeAdapter<E> elementAdapter, ObjectConstructor<? extends
        Collection<E>> constructor) {
    this.constructor = constructor;
    this.elementTypeAdapter = elementAdapter;
}
 
源代码21 项目: framework   文件: ReflectiveTypeAdapterFactory.java
private Adapter(ObjectConstructor<T> constructor, Map<String, BoundField> boundFields) {
  this.constructor = constructor;
  this.boundFields = boundFields;
}
 
源代码评论
动弹
沙发等你来抢
 类所在包
 类方法
 同包方法