Class DynamicMappingGenerator

    • Method Detail

      • getRawJsonGenerator

        protected jakarta.json.stream.JsonGenerator getRawJsonGenerator()
      • getJsonGenerator

        public jakarta.json.stream.JsonGenerator getJsonGenerator()
        Specified by:
        getJsonGenerator in interface MappingGenerator
        Returns:
        the JsonGenerator used internally to write the JSON output.
      • writeObject

        public MappingGenerator writeObject​(Object o,
                                            jakarta.json.stream.JsonGenerator generator)
        Description copied from interface: MappingGenerator
        Write the given Object o into the current JSON layer. This will not open a new json layer ('{', '}') but really just write the attributes of o to the currently opened layer. Consider you have a class
             public class Customer {
                 private String firstName;
                 private String lastName;
                 private Address address;
                 ...
             }
         
        then the resulting JSON String will e.g. look like
             "firstName":"Karl", "lastName":"SomeName", "address":{"street":"mystreet"}
         
        Specified by:
        writeObject in interface MappingGenerator
        Parameters:
        o - the object to write
        generator - the jsonp generator to use
        Returns:
        itself, for easier chaining of commands
      • ensureGenerator

        private jakarta.json.stream.JsonGenerator ensureGenerator​(jakarta.json.stream.JsonGenerator generator)
      • reset

        protected void reset()
      • flushIfNeeded

        public void flushIfNeeded()