Interface GsonSupport


  • public interface GsonSupport
    Extension interface that makes IBeans serializable and deserializable with Gson. If an IBean interface extends GsonSupport you are able to convert any IBean instance from and to JSON. For this to work you need another two prerequisites:
    See Also:
    Gson
    • Method Detail

      • readFromJsonObject

        void readFromJsonObject​(JsonObject jsonObject,
                                JsonDeserializationContext context)
        Reads the field values from a JsonObject and sets the fields of this IBean to the retrieved values.

        You normally do not use this method directly. It is mainly called from GsonSerializerDeserializerForIBeans during JSON deserialization.

        Parameters:
        jsonObject - the JsonObject reading some JSON representation of this IBean
        context - the Gson deserialization context
      • writeToJsonObject

        void writeToJsonObject​(JsonObject jsonObject,
                               JsonSerializationContext context)
        Writes the field values of this IBean out into a JsonObject.

        You normally do not use this method directly. It is mainly called from GsonSerializerDeserializerForIBeans during JSON serialization.

        Parameters:
        jsonObject - the target where to write the field value to
        context - the Gson serialization context