类 _GsonUtil


  • public final class _GsonUtil
    extends java.lang.Object
    This utility class is injected into the program class pool when the GSON optimizations are applied. It contains the logic for picking the right type adapter for a given type and value that needs to be serialized. The injected toJson() methods in the domain classes will use these utility methods for serializing the fields of the domain class with the appropriate type adapter.
    • 构造器概要

      构造器 
      构造器 说明
      _GsonUtil()  
    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型 方法 说明
      static void dumpTypeTokenCache​(java.lang.String message, java.util.Map<com.google.gson.reflect.TypeToken<?>,​com.google.gson.TypeAdapter<?>> typeTokenCache)
      Dumps the cached type adapter for each type for debugging purpose.
      static com.google.gson.TypeAdapter getTypeAdapter​(com.google.gson.Gson gson, com.google.gson.reflect.TypeToken declaredTypeToken, java.lang.Object value)
      Returns the appropriate type adapter for handling the given value with the given declared type token.
      static com.google.gson.TypeAdapter getTypeAdapter​(com.google.gson.Gson gson, java.lang.Class declaredType, java.lang.Object value)
      Returns the appropriate type adapter for handling the given value with the given declared type.
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细资料

      • _GsonUtil

        public _GsonUtil()
    • 方法详细资料

      • getTypeAdapter

        public static com.google.gson.TypeAdapter getTypeAdapter​(com.google.gson.Gson gson,
                                                                 java.lang.Class declaredType,
                                                                 java.lang.Object value)
        Returns the appropriate type adapter for handling the given value with the given declared type.
        参数:
        gson - the Gson context that manages all registered type adapters.
        declaredType - the type of the value to (de)serialize.
        value - the value to (de)serialize.
        返回:
        the type adapter for handling the given value and declared type.
      • getTypeAdapter

        public static com.google.gson.TypeAdapter getTypeAdapter​(com.google.gson.Gson gson,
                                                                 com.google.gson.reflect.TypeToken declaredTypeToken,
                                                                 java.lang.Object value)
        Returns the appropriate type adapter for handling the given value with the given declared type token.
        参数:
        gson - the Gson context that manages all registered type adapters.
        declaredTypeToken - the declared type token of the value to (de)serialize.
        value - the value to (de)serialize.
        返回:
        the type adapter for handling the given value and declared type.
      • dumpTypeTokenCache

        public static void dumpTypeTokenCache​(java.lang.String message,
                                              java.util.Map<com.google.gson.reflect.TypeToken<?>,​com.google.gson.TypeAdapter<?>> typeTokenCache)
        Dumps the cached type adapter for each type for debugging purpose.