类 GsonFactoryBean
java.lang.Object
cn.taketoday.http.converter.json.GsonFactoryBean
- 所有已实现的接口:
cn.taketoday.beans.factory.FactoryBean<com.google.gson.Gson>,cn.taketoday.beans.factory.InitializingBean
public class GsonFactoryBean
extends Object
implements cn.taketoday.beans.factory.FactoryBean<com.google.gson.Gson>, cn.taketoday.beans.factory.InitializingBean
A
FactoryBean for creating a Google Gson 2.x Gson instance.- 从以下版本开始:
- 4.0
- 作者:
- Roy Clarkson, Juergen Hoeller
-
字段概要
字段修饰符和类型字段说明private booleanprivate Stringprivate booleanprivate com.google.gson.Gsonprivate booleanprivate boolean从接口继承的字段 cn.taketoday.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidcom.google.gson.GsonReturn the created Gson instance.Class<?>booleanvoidsetBase64EncodeByteArrays(boolean base64EncodeByteArrays) Whether to Base64-encodebyte[]properties when reading and writing JSON.voidsetDateFormatPattern(String dateFormatPattern) Define the date/time format with aSimpleDateFormat-style pattern.voidsetDisableHtmlEscaping(boolean disableHtmlEscaping) Whether to use theGsonBuilder.disableHtmlEscaping()when writing JSON.voidsetPrettyPrinting(boolean prettyPrinting) Whether to use theGsonBuilder.setPrettyPrinting()when writing JSON.voidsetSerializeNulls(boolean serializeNulls) Whether to use theGsonBuilder.serializeNulls()option when writing JSON.
-
字段详细资料
-
base64EncodeByteArrays
private boolean base64EncodeByteArrays -
serializeNulls
private boolean serializeNulls -
prettyPrinting
private boolean prettyPrinting -
disableHtmlEscaping
private boolean disableHtmlEscaping -
dateFormatPattern
-
gson
@Nullable private com.google.gson.Gson gson
-
-
构造器详细资料
-
GsonFactoryBean
public GsonFactoryBean()
-
-
方法详细资料
-
setBase64EncodeByteArrays
public void setBase64EncodeByteArrays(boolean base64EncodeByteArrays) Whether to Base64-encodebyte[]properties when reading and writing JSON.When set to
true, a customTypeAdapterwill be registered viaGsonBuilder.registerTypeHierarchyAdapter(Class, Object)which serializes abyte[]property to and from a Base64-encoded String instead of a JSON array. -
setSerializeNulls
public void setSerializeNulls(boolean serializeNulls) Whether to use theGsonBuilder.serializeNulls()option when writing JSON. This is a shortcut for setting up aGsonas follows:new GsonBuilder().serializeNulls().create();
-
setPrettyPrinting
public void setPrettyPrinting(boolean prettyPrinting) Whether to use theGsonBuilder.setPrettyPrinting()when writing JSON. This is a shortcut for setting up aGsonas follows:new GsonBuilder().setPrettyPrinting().create();
-
setDisableHtmlEscaping
public void setDisableHtmlEscaping(boolean disableHtmlEscaping) Whether to use theGsonBuilder.disableHtmlEscaping()when writing JSON. Set totrueto disable HTML escaping in JSON. This is a shortcut for setting up aGsonas follows:new GsonBuilder().disableHtmlEscaping().create();
-
setDateFormatPattern
Define the date/time format with aSimpleDateFormat-style pattern. This is a shortcut for setting up aGsonas follows:new GsonBuilder().setDateFormat(dateFormatPattern).create();
-
afterPropertiesSet
public void afterPropertiesSet()- 指定者:
afterPropertiesSet在接口中cn.taketoday.beans.factory.InitializingBean
-
getObject
@Nullable public com.google.gson.Gson getObject()Return the created Gson instance.- 指定者:
getObject在接口中cn.taketoday.beans.factory.FactoryBean<com.google.gson.Gson>
-
getObjectType
- 指定者:
getObjectType在接口中cn.taketoday.beans.factory.FactoryBean<com.google.gson.Gson>
-
isSingleton
public boolean isSingleton()- 指定者:
isSingleton在接口中cn.taketoday.beans.factory.FactoryBean<com.google.gson.Gson>
-