Package com.google.gson 的 API 的学习(1)

Package com.google.gson
这个包提供了将 json转化成java 和 将java转化成json的 gson类。


Interface Description
接口介绍
ExclusionStrategy 排除策略
A strategy (or policy) definition that is used to decide whether or not a field or top-level class should be serialized or deserialized as part of the JSON output/input.
策略定义,用于决定字段或者是顶级类是否作为作为json输入/输出的一部分被序列化或者反序列化。

FieldNamingStrategy 字段命名策略
A mechanism for providing custom field naming in Gson.
Gson中提供了自定义字段名称的机制。

InstanceCreator<T> 生成器实例
This interface is implemented to create instances of a class that does not define a no-args constructor.
实现此接口来创建无参构造函数类的实例。

JsonDeserializationContext :json反序列化器上下文
Context for deserialization that is passed to a custom deserializer during invocation of its JsonDeserializer.deserialize(JsonElement, Type, JsonDeserializationContext) method.
反序列化上下文在调用它的json反序列化器【序列化方法(json元素,类型,json反序列化上下文)】的时候传递了一个自定义反序列化器。

JsonDeserializer<T> json反序列化器(T)
Interface representing a custom deserializer for Json.
接口用于表现(陈述)json的自定义反序列化器。

JsonSerializationContext json序列化器上下文
Context for serialization that is passed to a custom serializer during invocation of its JsonSerializer.serialize(Object, Type, JsonSerializationContext) method.
序列化上下文在调用它json序列化器时候传递了一个自定义序列号器

JsonSerializer<T> json序列器(T)
Interface representing a custom serializer for Json.
接口用于表现json的一个自定义序列化器。

TypeAdapterFactory 类型适配器工厂
Creates type adapters for set of related types.
为相关类型集合创建一个类型适配器。

Class Summary [类 摘要]
FieldAttributes 字段属性类
A data object that stores attributes of a field.
用来存储字段属性的数据对象。

Gson
This is the main class for using Gson.
这是一个使用Gson的主要类。

GsonBuilder
Use this builder to construct a Gson instance when you need to set configuration options other than the default.
当你需要去设置除缺省值之外的配置项时候,用这个构造器创建一个Gson实例。

JsonArray
A class representing an array type in Json.
用于表现json数组类型的类。

JsonElement
A class representing an element of Json.
用于表现json元素的类。

JsonNull
A class representing a Json null value.
用户表现json空值的类。

JsonObject
A class representing an object type in Json.
用于表现json对象类型的类

JsonParser
A parser to parse Json into a parse tree of JsonElements
将json解析成(*json元素)解析树的解析器。

JsonPrimitive
A class representing a Json primitive value.
一个表现json原始值的类。

JsonStreamParser
A streaming parser that allows reading of multiple JsonElements from the specified reader asynchronously.
一个流解析器,允许从指定阅读器异步读取多个json元素。

TypeAdapter<T>
Converts Java objects to and from JSON.
将java对象转化成JSON

Enum Summary 枚举概要
FieldNamingPolicy 字段命名策略
An enumeration that defines a few standard naming conventions for JSON field names.
为json字段名称定义了一些标准命名约定的枚举。

LongSerializationPolicy 长类型序列化策略
Defines the expected format for a long or Long type when its serialized.
在序列化的时 定义 long类型或者Long对象类型预期格式。

Exception Summary 异常概要
JsonIOException
This exception is raised when Gson was unable to read an input stream or write to one.
当Gson不能读取输入流或者写入的时候,异常就会被提出。

JsonParseException
This exception is raised if there is a serious issue that occurs during parsing of a Json string.
当格式化json字符串时发生严重的错误,异常被提出。

JsonSyntaxException
This exception is raised when Gson attempts to read (or write) a malformed JSON element.
当Gson试图读取或者写入一个畸形json元素的时候,异常被提出。



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
包含以下java源文件: com.google.gson.DefaultDateTypeAdapter.class com.google.gson.ExclusionStrategy.class com.google.gson.FieldAttributes.class com.google.gson.FieldNamingPolicy.class com.google.gson.FieldNamingStrategy.class com.google.gson.Gson.class com.google.gson.GsonBuilder.class com.google.gson.InstanceCreator.class com.google.gson.JsonArray.class com.google.gson.JsonDeserializationContext.class com.google.gson.JsonDeserializer.class com.google.gson.JsonElement.class com.google.gson.JsonIOException.class com.google.gson.JsonNull.class com.google.gson.JsonObject.class com.google.gson.JsonParseException.class com.google.gson.JsonParser.class com.google.gson.JsonPrimitive.class com.google.gson.JsonSerializationContext.class com.google.gson.JsonSerializer.class com.google.gson.JsonStreamParser.class com.google.gson.JsonSyntaxException.class com.google.gson.LongSerializationPolicy.class com.google.gson.TreeTypeAdapter.class com.google.gson.TypeAdapter.class com.google.gson.TypeAdapterFactory.class com.google.gson.annotations.Expose.class com.google.gson.annotations.SerializedName.class com.google.gson.annotations.Since.class com.google.gson.annotations.Until.class com.google.gson.internal.ConstructorConstructor.class com.google.gson.internal.Excluder.class com.google.gson.internal.JsonReaderInternalAccess.class com.google.gson.internal.LazilyParsedNumber.class com.google.gson.internal.LinkedTreeMap.class com.google.gson.internal.ObjectConstructor.class com.google.gson.internal.Primitives.class com.google.gson.internal.Streams.class com.google.gson.internal.UnsafeAllocator.class com.google.gson.internal.bind.ArrayTypeAdapter.class com.google.gson.internal.bind.CollectionTypeAdapterFactory.class com.google.gson.internal.bind.DateTypeAdapter.class com.google.gson.internal.bind.JsonTreeReader.class com.google.gson.internal.bind.JsonTreeWriter.class com.google.gson.internal.bind.MapTypeAdapterFactory.class com.google.gson.internal.bind.ObjectTypeAdapter.class com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.class com.google.gson.internal.bind.SqlDateTypeAdapter.class com.google.gson.internal.bind.TimeTypeAdapter.class com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.class com.google.gson.internal.bind.TypeAdapters.class com.google.gson.reflect.TypeToken.class com.google.gson.stream.JsonReader.class com.google.gson.stream.JsonScope.class com.google.gson.stream.JsonToken.class com.google.gson.stream.JsonWriter.class com.google.gson.stream.MalformedJsonException.class
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值