Class JsonWriter


  • public class JsonWriter
    extends Object
    • Constructor Detail

      • JsonWriter

        public JsonWriter()
    • Method Detail

      • remapField

        public <T> void remapField​(Class<T> type,
                                   String fromJava,
                                   String toJson)
        remap field name in custom classes
        Parameters:
        fromJava - field name in java
        toJson - field name in json
        Since:
        2.1.1
      • getWriterByInterface

        public JsonWriterI getWriterByInterface​(Class<?> clazz)
        try to find a Writer by Checking implemented interface
        Parameters:
        clazz - class to serialize
        Returns:
        a Writer or null
      • init

        public void init()
      • addInterfaceWriterFirst

        public void addInterfaceWriterFirst​(Class<?> interFace,
                                            JsonWriterI<?> writer)
        Deprecated.
        use registerWriterInterfaceFirst
        associate an Writer to a interface With Hi priority
        Parameters:
        interFace - interface to map
        writer - writer Object
      • addInterfaceWriterLast

        public void addInterfaceWriterLast​(Class<?> interFace,
                                           JsonWriterI<?> writer)
        Deprecated.
        use registerWriterInterfaceLast
        associate an Writer to a interface With Low priority
        Parameters:
        interFace - interface to map
        writer - writer Object
      • registerWriterInterfaceLast

        public void registerWriterInterfaceLast​(Class<?> interFace,
                                                JsonWriterI<?> writer)
        associate an Writer to a interface With Low priority
        Parameters:
        interFace - interface to map
        writer - writer Object
      • registerWriterInterfaceFirst

        public void registerWriterInterfaceFirst​(Class<?> interFace,
                                                 JsonWriterI<?> writer)
        associate an Writer to a interface With Hi priority
        Parameters:
        interFace - interface to map
        writer - writer Object
      • registerWriterInterface

        public void registerWriterInterface​(Class<?> interFace,
                                            JsonWriterI<?> writer)
        an alias for registerWriterInterfaceLast
        Parameters:
        interFace - interface to map
        writer - writer Object
      • registerWriter

        public <T> void registerWriter​(JsonWriterI<T> writer,
                                       Class<?>... cls)
        associate an Writer to a Class
        Parameters:
        writer -
        cls -