Interface Jsonator<T>

  • All Known Implementing Classes:
    DefaultJsonator

    public interface Jsonator<T>
    Interface to implement if you want to provide a method to create a JSON representation of an object
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  Jsonator.EnumConversionMode
      Defines handling of Java enums during Object to JSON conversion.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      com.google.common.base.Function<T,​com.google.gson.JsonElement> convert()  
      com.google.gson.JsonElement convert​(T object)
      Creates a JsonElement representation of a given object.
      com.google.gson.JsonElement convert​(T object, Jsonator.EnumConversionMode enumConversionMode)
      Creates a JsonElement representation of a given object
    • Method Detail

      • convert

        com.google.gson.JsonElement convert​(T object)
        Creates a JsonElement representation of a given object. Enums are converted to their names.
        Parameters:
        object - the object to be serialized
        Returns:
        Json JSON representation of the given object
      • convert

        com.google.common.base.Function<T,​com.google.gson.JsonElement> convert()
        Returns:
        a function to map objects to their JsonElements representation. Enums are converted to their names.
      • convert

        com.google.gson.JsonElement convert​(T object,
                                            Jsonator.EnumConversionMode enumConversionMode)
        Creates a JsonElement representation of a given object
        Parameters:
        object - the object to be serialized
        enumConversionMode - defines enum handling
        Returns:
        Json JSON representation of the given object