Class Marshaller

  • All Implemented Interfaces:
    javax.json.bind.serializer.SerializationContext

    public class Marshaller
    extends ProcessingContext
    implements javax.json.bind.serializer.SerializationContext
    JSONB marshaller. Created each time marshalling operation called.
    Author:
    Dmitry Kornilov, Roman Grigoriadi
    • Constructor Detail

      • Marshaller

        public Marshaller​(JsonbContext jsonbContext,
                          Type rootRuntimeType)
        Creates Marshaller for generation to String.
        Parameters:
        jsonbContext - Current context.
        rootRuntimeType - Type of root object.
      • Marshaller

        public Marshaller​(JsonbContext jsonbContext)
        Creates Marshaller for generation to String.
        Parameters:
        jsonbContext - Current context.
    • Method Detail

      • marshall

        public void marshall​(Object object,
                             javax.json.stream.JsonGenerator jsonGenerator)
        Marshals given object to provided Writer or OutputStream.
        Parameters:
        object - object to marshall
        jsonGenerator - generator to use
      • serialize

        public <T> void serialize​(String key,
                                  T object,
                                  javax.json.stream.JsonGenerator generator)
        Specified by:
        serialize in interface javax.json.bind.serializer.SerializationContext
      • serialize

        public <T> void serialize​(T object,
                                  javax.json.stream.JsonGenerator generator)
        Specified by:
        serialize in interface javax.json.bind.serializer.SerializationContext
      • serializeRoot

        public <T> void serializeRoot​(T root,
                                      javax.json.stream.JsonGenerator generator,
                                      ClassModel classModel)
        Serializes root element.
        Type Parameters:
        T - Root type
        Parameters:
        root - Root.
        generator - JSON generator.
        classModel - Class model.