Class ClassSerializer

  • All Implemented Interfaces:
    JsonFormatVisitable, SchemaAware, java.io.Serializable

    public class ClassSerializer
    extends StdScalarSerializer<java.lang.Class<?>>
    Also: default bean access will not do much good with Class.class. But we can just serialize the class name and that should be enough.
    See Also:
    Serialized Form
    • Constructor Detail

      • ClassSerializer

        public ClassSerializer()
    • Method Detail

      • serialize

        public void serialize​(java.lang.Class<?> value,
                              com.fasterxml.jackson.core.JsonGenerator g,
                              SerializerProvider provider)
                       throws java.io.IOException
        Description copied from class: JsonSerializer
        Method that can be called to ask implementation to serialize values of type this serializer handles.
        Specified by:
        serialize in class StdSerializer<java.lang.Class<?>>
        Parameters:
        value - Value to serialize; can not be null.
        g - Generator used to output resulting Json content
        provider - Provider that can be used to get serializers for serializing Objects value contains, if any.
        Throws:
        java.io.IOException
      • getSchema

        public JsonNode getSchema​(SerializerProvider provider,
                                  java.lang.reflect.Type typeHint)
        Description copied from class: StdSerializer
        Default implementation simply claims type is "string"; usually overriden by custom serializers.
        Specified by:
        getSchema in interface SchemaAware
        Overrides:
        getSchema in class StdScalarSerializer<java.lang.Class<?>>
        Parameters:
        provider - The serializer provider.
        typeHint - A hint about the type.
        Returns:
        Json-schema for this serializer.