项目:odoo-work
文件:JsonAdapterAnnotationTypeAdapterFactory.java
@SuppressWarnings("unchecked") // Casts guarded by conditionals.
static TypeAdapter<?> getTypeAdapter(ConstructorConstructor constructorConstructor,Gson gson,TypeToken<?> fieldType,JsonAdapter annotation) {
Class<?> value = annotation.value();
if (TypeAdapter.class.isAssignableFrom(value)) {
Class<TypeAdapter<?>> typeAdapter = (Class<TypeAdapter<?>>) value;
return constructorConstructor.get(TypeToken.get(typeAdapter)).construct();
}
if (TypeAdapterFactory.class.isAssignableFrom(value)) {
Class<TypeAdapterFactory> typeAdapterFactory = (Class<TypeAdapterFactory>) value;
return constructorConstructor.get(TypeToken.get(typeAdapterFactory))
.construct()
.create(gson,fieldType);
}
throw new IllegalArgumentException(
"@JsonAdapter value must be TypeAdapter or TypeAdapterFactory reference.");
}
项目:odoo-follow-up
文件:JsonAdapterAnnotationTypeAdapterFactory.java
@SuppressWarnings("unchecked") // Casts guarded by conditionals.
static TypeAdapter<?> getTypeAdapter(ConstructorConstructor constructorConstructor,fieldType);
}
throw new IllegalArgumentException(
"@JsonAdapter value must be TypeAdapter or TypeAdapterFactory reference.");
}
项目:MyJojoXUtils
文件:JsonAdapterAnnotationTypeAdapterFactory.java
@SuppressWarnings("unchecked") // Casts guarded by conditionals.
static TypeAdapter<?> getTypeAdapter(ConstructorConstructor constructorConstructor,JsonAdapter annotation) {
Class<?> value = annotation.value();
TypeAdapter<?> typeAdapter;
if (TypeAdapter.class.isAssignableFrom(value)) {
Class<TypeAdapter<?>> typeAdapterClass = (Class<TypeAdapter<?>>) value;
typeAdapter = constructorConstructor.get(TypeToken.get(typeAdapterClass)).construct();
} else if (TypeAdapterFactory.class.isAssignableFrom(value)) {
Class<TypeAdapterFactory> typeAdapterFactory = (Class<TypeAdapterFactory>) value;
typeAdapter = constructorConstructor.get(TypeToken.get(typeAdapterFactory))
.construct()
.create(gson,fieldType);
} else {
throw new IllegalArgumentException(
"@JsonAdapter value must be TypeAdapter or TypeAdapterFactory reference.");
}
if (typeAdapter != null) {
typeAdapter = typeAdapter.nullSafe();
}
return typeAdapter;
}
项目:StaticMC
文件:JsonAdapterAnnotationTypeAdapterFactory.java
@SuppressWarnings("unchecked") // Casts guarded by conditionals.
static TypeAdapter<?> getTypeAdapter(ConstructorConstructor constructorConstructor,fieldType);
}
throw new IllegalArgumentException(
"@JsonAdapter value must be TypeAdapter or TypeAdapterFactory reference.");
}
项目:boohee_v5.6
文件:JsonAdapterAnnotationTypeAdapterFactory.java
static TypeAdapter<?> getTypeAdapter(ConstructorConstructor constructorConstructor,Gson
gson,JsonAdapter annotation) {
Class<?> value = annotation.value();
if (TypeAdapter.class.isAssignableFrom(value)) {
return (TypeAdapter) constructorConstructor.get(TypeToken.get((Class) value))
.construct();
}
if (TypeAdapterFactory.class.isAssignableFrom(value)) {
return ((TypeAdapterFactory) constructorConstructor.get(TypeToken.get((Class) value))
.construct()).create(gson,fieldType);
}
throw new IllegalArgumentException("@JsonAdapter value must be TypeAdapter or " +
"TypeAdapterFactory reference.");
}
项目:SteamLib
文件:JsonAdapterAnnotationTypeAdapterFactory.java
@SuppressWarnings({ "unchecked","rawtypes" }) // Casts guarded by conditionals.
TypeAdapter<?> getTypeAdapter(ConstructorConstructor constructorConstructor,TypeToken<?> type,JsonAdapter annotation) {
Object instance = constructorConstructor.get(TypeToken.get(annotation.value())).construct();
TypeAdapter<?> typeAdapter;
if (instance instanceof TypeAdapter) {
typeAdapter = (TypeAdapter<?>) instance;
} else if (instance instanceof TypeAdapterFactory) {
typeAdapter = ((TypeAdapterFactory) instance).create(gson,type);
} else if (instance instanceof JsonSerializer || instance instanceof JsonDeserializer) {
JsonSerializer<?> serializer = instance instanceof JsonSerializer
? (JsonSerializer) instance
: null;
JsonDeserializer<?> deserializer = instance instanceof JsonDeserializer
? (JsonDeserializer) instance
: null;
typeAdapter = new TreeTypeAdapter(serializer,deserializer,gson,type,null);
} else {
throw new IllegalArgumentException(
"@JsonAdapter value must be TypeAdapter,TypeAdapterFactory,"
+ "JsonSerializer or JsonDeserializer reference.");
}
if (typeAdapter != null) {
typeAdapter = typeAdapter.nullSafe();
}
return typeAdapter;
}
项目:SteamLib
文件:ReflectiveTypeAdapterFactory.java
public ReflectiveTypeAdapterFactory(ConstructorConstructor constructorConstructor,FieldNamingStrategy fieldNamingPolicy,Excluder excluder,JsonAdapterAnnotationTypeAdapterFactory jsonAdapterFactory) {
this.constructorConstructor = constructorConstructor;
this.fieldNamingPolicy = fieldNamingPolicy;
this.excluder = excluder;
this.jsonAdapterFactory = jsonAdapterFactory;
}
项目:1797-2017
文件:JsonAdapterAnnotationTypeAdapterFactory.java
@SuppressWarnings({ "unchecked","
+ "JsonSerializer or JsonDeserializer reference.");
}
if (typeAdapter != null && annotation.nullSafe()) {
typeAdapter = typeAdapter.nullSafe();
}
return typeAdapter;
}
项目:1797-2017
文件:ReflectiveTypeAdapterFactory.java
public ReflectiveTypeAdapterFactory(ConstructorConstructor constructorConstructor,JsonAdapterAnnotationTypeAdapterFactory jsonAdapterFactory) {
this.constructorConstructor = constructorConstructor;
this.fieldNamingPolicy = fieldNamingPolicy;
this.excluder = excluder;
this.jsonAdapterFactory = jsonAdapterFactory;
}
项目:urmusic-desktop
文件:JsonAdapterAnnotationTypeAdapterFactory.java
@SuppressWarnings({ "unchecked","
+ "JsonSerializer or JsonDeserializer reference.");
}
if (typeAdapter != null && annotation.nullSafe()) {
typeAdapter = typeAdapter.nullSafe();
}
return typeAdapter;
}
项目:urmusic-desktop
文件:ReflectiveTypeAdapterFactory.java
public ReflectiveTypeAdapterFactory(ConstructorConstructor constructorConstructor,JsonAdapterAnnotationTypeAdapterFactory jsonAdapterFactory) {
this.constructorConstructor = constructorConstructor;
this.fieldNamingPolicy = fieldNamingPolicy;
this.excluder = excluder;
this.jsonAdapterFactory = jsonAdapterFactory;
}
项目:lastaflute
文件:GsonJsonEngine.java
protected LaReflectiveTypeAdapterFactory createReflectiveTypeAdapterFactory(Gson newGson,Object factory) {
final ConstructorConstructor constructorConstructor = getConstructorConstructor(factory);
final JsonAdapterAnnotationTypeAdapterFactory jsonAdapterFactory = getJsonAdapterFactory(factory);
final FieldNamingStrategy fieldNamingStrategy = newGson.fieldNamingStrategy();
final Excluder excluder = newGson.excluder();
return new LaReflectiveTypeAdapterFactory(constructorConstructor,fieldNamingStrategy,excluder,jsonAdapterFactory);
}
项目:lastaflute
文件:LaReflectiveTypeAdapterFactory.java
public LaReflectiveTypeAdapterFactory(ConstructorConstructor constructorConstructor,JsonAdapterAnnotationTypeAdapterFactory jsonAdapterFactory) {
this.constructorConstructor = constructorConstructor;
this.fieldNamingPolicy = fieldNamingPolicy;
this.excluder = excluder;
this.jsonAdapterFactory = jsonAdapterFactory;
}
项目:hyperdata
文件:HyperDataTypeAdapter.java
public HyperDataTypeAdapter(MetadataAccess metaAccess,ConstructorConstructor constructorConstructor,ObjectConstructor<Object> constructor,Map<String,BoundField> boundFields,ReflectiveTypeAdapterFactory reflectiveFactory) {
super();
this.constructorConstructor = constructorConstructor;
this.constructor = constructor;
this.boundFields = boundFields;
this.gson = gson;
this.reflectiveFactory = reflectiveFactory;
this.metadataAccess = metaAccess;
}
项目:hyperdata
文件:HyperDataGsonBuilder.java
@Override
protected void doCreate(ConstructorConstructor constructorConstructor,Excluder excluder) {
registerTypeAdapterFactory(new HyperDataAdapterFactory(constructorConstructor,fieldNamingPolicy,excluder));
registerTypeAdapter(HyperMap.class,new GsonHyperDataDeserializer());
registerTypeAdapter(HyperMap.class,new GsonHyperDataSerializer());
registerTypeAdapter(HyperHashMap.class,new GsonHyperDataDeserializer());
registerTypeAdapter(HyperHashMap.class,new GsonHyperDataSerializer());
}
项目:letv
文件:MapTypeAdapterFactory.java
public MapTypeAdapterFactory(ConstructorConstructor constructorConstructor,boolean complexMapKeySerialization) {
this.constructorConstructor = constructorConstructor;
this.complexMapKeySerialization = complexMapKeySerialization;
}
项目:letv
文件:CollectionTypeAdapterFactory.java
public CollectionTypeAdapterFactory(ConstructorConstructor constructorConstructor) {
this.constructorConstructor = constructorConstructor;
}
项目:letv
文件:ReflectiveTypeAdapterFactory.java
public ReflectiveTypeAdapterFactory(ConstructorConstructor constructorConstructor,Excluder excluder) {
this.constructorConstructor = constructorConstructor;
this.fieldNamingPolicy = fieldNamingPolicy;
this.excluder = excluder;
}
项目:odoo-work
文件:Gson.java
Gson(final Excluder excluder,final FieldNamingStrategy fieldNamingPolicy,final Map<Type,InstanceCreator<?>> instanceCreators,boolean serializeNulls,boolean complexMapKeySerialization,boolean generateNonExecutableGson,boolean htmlSafe,boolean prettyPrinting,boolean serializeSpecialFloatingPointValues,LongSerializationPolicy longSerializationPolicy,List<TypeAdapterFactory> typeAdapterFactories) {
this.constructorConstructor = new ConstructorConstructor(instanceCreators);
this.serializeNulls = serializeNulls;
this.generateNonExecutableJson = generateNonExecutableGson;
this.htmlSafe = htmlSafe;
this.prettyPrinting = prettyPrinting;
List<TypeAdapterFactory> factories = new ArrayList<TypeAdapterFactory>();
// built-in type adapters that cannot be overridden
factories.add(TypeAdapters.JSON_ELEMENT_FACTORY);
factories.add(ObjectTypeAdapter.FACTORY);
// the excluder must precede all adapters that handle user-defined types
factories.add(excluder);
// user's type adapters
factories.addAll(typeAdapterFactories);
// type adapters for basic platform types
factories.add(TypeAdapters.STRING_FACTORY);
factories.add(TypeAdapters.INTEGER_FACTORY);
factories.add(TypeAdapters.BOOLEAN_FACTORY);
factories.add(TypeAdapters.BYTE_FACTORY);
factories.add(TypeAdapters.SHORT_FACTORY);
factories.add(TypeAdapters.newFactory(long.class,Long.class,longAdapter(longSerializationPolicy)));
factories.add(TypeAdapters.newFactory(double.class,Double.class,doubleAdapter(serializeSpecialFloatingPointValues)));
factories.add(TypeAdapters.newFactory(float.class,Float.class,floatAdapter(serializeSpecialFloatingPointValues)));
factories.add(TypeAdapters.NUMBER_FACTORY);
factories.add(TypeAdapters.CHARACTER_FACTORY);
factories.add(TypeAdapters.STRING_BUILDER_FACTORY);
factories.add(TypeAdapters.STRING_BUFFER_FACTORY);
factories.add(TypeAdapters.newFactory(BigDecimal.class,TypeAdapters.BIG_DECIMAL));
factories.add(TypeAdapters.newFactory(BigInteger.class,TypeAdapters.BIG_INTEGER));
factories.add(TypeAdapters.URL_FACTORY);
factories.add(TypeAdapters.URI_FACTORY);
factories.add(TypeAdapters.UUID_FACTORY);
factories.add(TypeAdapters.LOCALE_FACTORY);
factories.add(TypeAdapters.INET_ADDRESS_FACTORY);
factories.add(TypeAdapters.BIT_SET_FACTORY);
factories.add(DateTypeAdapter.FACTORY);
factories.add(TypeAdapters.CALENDAR_FACTORY);
factories.add(TimeTypeAdapter.FACTORY);
factories.add(SqlDateTypeAdapter.FACTORY);
factories.add(TypeAdapters.TIMESTAMP_FACTORY);
factories.add(ArrayTypeAdapter.FACTORY);
factories.add(TypeAdapters.CLASS_FACTORY);
// type adapters for composite and user-defined types
factories.add(new CollectionTypeAdapterFactory(constructorConstructor));
factories.add(new MapTypeAdapterFactory(constructorConstructor,complexMapKeySerialization));
factories.add(new JsonAdapterAnnotationTypeAdapterFactory(constructorConstructor));
factories.add(TypeAdapters.ENUM_FACTORY);
factories.add(new ReflectiveTypeAdapterFactory(
constructorConstructor,excluder));
this.factories = Collections.unmodifiableList(factories);
}
项目:odoo-work
文件:MapTypeAdapterFactory.java
public MapTypeAdapterFactory(ConstructorConstructor constructorConstructor,boolean complexMapKeySerialization) {
this.constructorConstructor = constructorConstructor;
this.complexMapKeySerialization = complexMapKeySerialization;
}
项目:odoo-work
文件:JsonAdapterAnnotationTypeAdapterFactory.java
public JsonAdapterAnnotationTypeAdapterFactory(ConstructorConstructor constructorConstructor) {
this.constructorConstructor = constructorConstructor;
}
项目:odoo-work
文件:CollectionTypeAdapterFactory.java
public CollectionTypeAdapterFactory(ConstructorConstructor constructorConstructor) {
this.constructorConstructor = constructorConstructor;
}
项目:odoo-work
文件:ReflectiveTypeAdapterFactory.java
public ReflectiveTypeAdapterFactory(ConstructorConstructor constructorConstructor,Excluder excluder) {
this.constructorConstructor = constructorConstructor;
this.fieldNamingPolicy = fieldNamingPolicy;
this.excluder = excluder;
}
项目:lams
文件:Gson.java
Gson(final Excluder excluder,TypeAdapters.BIG_INTEGER));
factories.add(TypeAdapters.URL_FACTORY);
factories.add(TypeAdapters.URI_FACTORY);
factories.add(TypeAdapters.UUID_FACTORY);
factories.add(TypeAdapters.LOCALE_FACTORY);
factories.add(TypeAdapters.INET_ADDRESS_FACTORY);
factories.add(TypeAdapters.BIT_SET_FACTORY);
factories.add(DateTypeAdapter.FACTORY);
factories.add(TypeAdapters.CALENDAR_FACTORY);
factories.add(TimeTypeAdapter.FACTORY);
factories.add(SqlDateTypeAdapter.FACTORY);
factories.add(TypeAdapters.TIMESTAMP_FACTORY);
factories.add(ArrayTypeAdapter.FACTORY);
factories.add(TypeAdapters.ENUM_FACTORY);
factories.add(TypeAdapters.CLASS_FACTORY);
// type adapters for composite and user-defined types
factories.add(new CollectionTypeAdapterFactory(constructorConstructor));
factories.add(new MapTypeAdapterFactory(constructorConstructor,complexMapKeySerialization));
factories.add(new ReflectiveTypeAdapterFactory(
constructorConstructor,excluder));
this.factories = Collections.unmodifiableList(factories);
}
项目:lams
文件:MapTypeAdapterFactory.java
public MapTypeAdapterFactory(ConstructorConstructor constructorConstructor,boolean complexMapKeySerialization) {
this.constructorConstructor = constructorConstructor;
this.complexMapKeySerialization = complexMapKeySerialization;
}
项目:lams
文件:CollectionTypeAdapterFactory.java
public CollectionTypeAdapterFactory(ConstructorConstructor constructorConstructor) {
this.constructorConstructor = constructorConstructor;
}
项目:lams
文件:ReflectiveTypeAdapterFactory.java
public ReflectiveTypeAdapterFactory(ConstructorConstructor constructorConstructor,Excluder excluder) {
this.constructorConstructor = constructorConstructor;
this.fieldNamingPolicy = fieldNamingPolicy;
this.excluder = excluder;
}
项目:boohee_v5.6
文件:Gson.java
Gson(Excluder excluder,Map<Type,InstanceCreator<?>>
instanceCreators,boolean
generateNonExecutableGson,boolean
serializeSpecialFloatingPointValues,List<TypeAdapterFactory> typeAdapterFactories) {
this.calls = new ThreadLocal();
this.typeTokenCache = Collections.synchronizedMap(new HashMap());
this.deserializationContext = new JsonDeserializationContext() {
public <T> T deserialize(JsonElement json,Type typeOfT) throws JsonParseException {
return Gson.this.fromJson(json,typeOfT);
}
};
this.serializationContext = new JsonSerializationContext() {
public JsonElement serialize(Object src) {
return Gson.this.toJsonTree(src);
}
public JsonElement serialize(Object src,Type typeOfSrc) {
return Gson.this.toJsonTree(src,typeOfSrc);
}
};
this.constructorConstructor = new ConstructorConstructor(instanceCreators);
this.serializeNulls = serializeNulls;
this.generateNonExecutableJson = generateNonExecutableGson;
this.htmlSafe = htmlSafe;
this.prettyPrinting = prettyPrinting;
List<TypeAdapterFactory> factories = new ArrayList();
factories.add(TypeAdapters.JSON_ELEMENT_FACTORY);
factories.add(ObjectTypeAdapter.FACTORY);
factories.add(excluder);
factories.addAll(typeAdapterFactories);
factories.add(TypeAdapters.STRING_FACTORY);
factories.add(TypeAdapters.INTEGER_FACTORY);
factories.add(TypeAdapters.BOOLEAN_FACTORY);
factories.add(TypeAdapters.BYTE_FACTORY);
factories.add(TypeAdapters.SHORT_FACTORY);
factories.add(TypeAdapters.newFactory(Long.TYPE,longAdapter
(longSerializationPolicy)));
factories.add(TypeAdapters.newFactory(Double.TYPE,doubleAdapter
(serializeSpecialFloatingPointValues)));
factories.add(TypeAdapters.newFactory(Float.TYPE,floatAdapter
(serializeSpecialFloatingPointValues)));
factories.add(TypeAdapters.NUMBER_FACTORY);
factories.add(TypeAdapters.CHARACTER_FACTORY);
factories.add(TypeAdapters.STRING_BUILDER_FACTORY);
factories.add(TypeAdapters.STRING_BUFFER_FACTORY);
factories.add(TypeAdapters.newFactory(BigDecimal.class,TypeAdapters.BIG_DECIMAL));
factories.add(TypeAdapters.newFactory(BigInteger.class,TypeAdapters.BIG_INTEGER));
factories.add(TypeAdapters.URL_FACTORY);
factories.add(TypeAdapters.URI_FACTORY);
factories.add(TypeAdapters.UUID_FACTORY);
factories.add(TypeAdapters.LOCALE_FACTORY);
factories.add(TypeAdapters.INET_ADDRESS_FACTORY);
factories.add(TypeAdapters.BIT_SET_FACTORY);
factories.add(DateTypeAdapter.FACTORY);
factories.add(TypeAdapters.CALENDAR_FACTORY);
factories.add(TimeTypeAdapter.FACTORY);
factories.add(SqlDateTypeAdapter.FACTORY);
factories.add(TypeAdapters.TIMESTAMP_FACTORY);
factories.add(ArrayTypeAdapter.FACTORY);
factories.add(TypeAdapters.ENUM_FACTORY);
factories.add(TypeAdapters.CLASS_FACTORY);
factories.add(new CollectionTypeAdapterFactory(this.constructorConstructor));
factories.add(new MapTypeAdapterFactory(this.constructorConstructor,complexMapKeySerialization));
factories.add(new JsonAdapterAnnotationTypeAdapterFactory(this.constructorConstructor));
factories.add(new ReflectiveTypeAdapterFactory(this.constructorConstructor,excluder));
this.factories = Collections.unmodifiableList(factories);
}
项目:boohee_v5.6
文件:MapTypeAdapterFactory.java
public MapTypeAdapterFactory(ConstructorConstructor constructorConstructor,boolean
complexMapKeySerialization) {
this.constructorConstructor = constructorConstructor;
this.complexMapKeySerialization = complexMapKeySerialization;
}
项目:boohee_v5.6
文件:JsonAdapterAnnotationTypeAdapterFactory.java
public JsonAdapterAnnotationTypeAdapterFactory(ConstructorConstructor constructorConstructor) {
this.constructorConstructor = constructorConstructor;
}
项目:boohee_v5.6
文件:CollectionTypeAdapterFactory.java
public CollectionTypeAdapterFactory(ConstructorConstructor constructorConstructor) {
this.constructorConstructor = constructorConstructor;
}
项目:boohee_v5.6
文件:ReflectiveTypeAdapterFactory.java
public ReflectiveTypeAdapterFactory(ConstructorConstructor constructorConstructor,Excluder excluder) {
this.constructorConstructor = constructorConstructor;
this.fieldNamingPolicy = fieldNamingPolicy;
this.excluder = excluder;
}
项目:Jerkoff
文件:GraphAdapterBuilder.java
public GraphAdapterBuilder() {
this.instanceCreators = new HashMap<Type,InstanceCreator<?>>();
this.constructorConstructor = new ConstructorConstructor(instanceCreators);
}
项目:odoo-follow-up
文件:Gson.java
Gson(final Excluder excluder,excluder));
this.factories = Collections.unmodifiableList(factories);
}
项目:odoo-follow-up
文件:MapTypeAdapterFactory.java
public MapTypeAdapterFactory(ConstructorConstructor constructorConstructor,boolean complexMapKeySerialization) {
this.constructorConstructor = constructorConstructor;
this.complexMapKeySerialization = complexMapKeySerialization;
}
项目:odoo-follow-up
文件:JsonAdapterAnnotationTypeAdapterFactory.java
public JsonAdapterAnnotationTypeAdapterFactory(ConstructorConstructor constructorConstructor) {
this.constructorConstructor = constructorConstructor;
}
项目:odoo-follow-up
文件:CollectionTypeAdapterFactory.java
public CollectionTypeAdapterFactory(ConstructorConstructor constructorConstructor) {
this.constructorConstructor = constructorConstructor;
}
项目:odoo-follow-up
文件:ReflectiveTypeAdapterFactory.java
public ReflectiveTypeAdapterFactory(ConstructorConstructor constructorConstructor,Excluder excluder) {
this.constructorConstructor = constructorConstructor;
this.fieldNamingPolicy = fieldNamingPolicy;
this.excluder = excluder;
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。