Class ObjectSerializer<T>

  • Type Parameters:
    T - object type
    All Implemented Interfaces:
    javax.json.bind.serializer.JsonbSerializer<T>, RuntimeTypeInfo, CurrentItem<T>

    public class ObjectSerializer<T>
    extends AbstractContainerSerializer<T>
    Serializes arbitrary object by reading its properties.
    • Constructor Detail

      • ObjectSerializer

        public ObjectSerializer​(SerializerBuilder builder)
        Creates a new instance.
        Parameters:
        builder - Builder to initialize the instance.
      • ObjectSerializer

        public ObjectSerializer​(CurrentItem<?> wrapper,
                                java.lang.reflect.Type runtimeType,
                                ClassModel classModel)
        Creates a new instance.
        Parameters:
        wrapper - wrapped item
        runtimeType - class type
        classModel - model of the class
    • Method Detail

      • serializeInternal

        protected void serializeInternal​(T object,
                                         javax.json.stream.JsonGenerator generator,
                                         javax.json.bind.serializer.SerializationContext ctx)
        Description copied from class: AbstractContainerSerializer
        Serialize content of provided container.
        Specified by:
        serializeInternal in class AbstractContainerSerializer<T>
        Parameters:
        object - container to be serialized
        generator - JSON format generator
        ctx - JSON serialization context
      • writeStart

        protected void writeStart​(java.lang.String key,
                                  javax.json.stream.JsonGenerator generator)
        Description copied from class: AbstractContainerSerializer
        Write start of an object or an array with a key.
        Specified by:
        writeStart in class AbstractContainerSerializer<T>
        Parameters:
        key - JSON key name.
        generator - JSON format generator