类 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
  • 字段详细资料

    • base64EncodeByteArrays

      private boolean base64EncodeByteArrays
    • serializeNulls

      private boolean serializeNulls
    • prettyPrinting

      private boolean prettyPrinting
    • disableHtmlEscaping

      private boolean disableHtmlEscaping
    • dateFormatPattern

      @Nullable private String dateFormatPattern
    • gson

      @Nullable private com.google.gson.Gson gson
  • 构造器详细资料

    • GsonFactoryBean

      public GsonFactoryBean()
  • 方法详细资料

    • setBase64EncodeByteArrays

      public void setBase64EncodeByteArrays(boolean base64EncodeByteArrays)
      Whether to Base64-encode byte[] properties when reading and writing JSON.

      When set to true, a custom TypeAdapter will be registered via GsonBuilder.registerTypeHierarchyAdapter(Class, Object) which serializes a byte[] property to and from a Base64-encoded String instead of a JSON array.

      另请参阅:
    • setSerializeNulls

      public void setSerializeNulls(boolean serializeNulls)
      Whether to use the GsonBuilder.serializeNulls() option when writing JSON. This is a shortcut for setting up a Gson as follows:
       new GsonBuilder().serializeNulls().create();
       
    • setPrettyPrinting

      public void setPrettyPrinting(boolean prettyPrinting)
      Whether to use the GsonBuilder.setPrettyPrinting() when writing JSON. This is a shortcut for setting up a Gson as follows:
       new GsonBuilder().setPrettyPrinting().create();
       
    • setDisableHtmlEscaping

      public void setDisableHtmlEscaping(boolean disableHtmlEscaping)
      Whether to use the GsonBuilder.disableHtmlEscaping() when writing JSON. Set to true to disable HTML escaping in JSON. This is a shortcut for setting up a Gson as follows:
       new GsonBuilder().disableHtmlEscaping().create();
       
    • setDateFormatPattern

      public void setDateFormatPattern(String dateFormatPattern)
      Define the date/time format with a SimpleDateFormat-style pattern. This is a shortcut for setting up a Gson as 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

      public Class<?> 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>