Class RawSerializer<T>
java.lang.Object
edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.JsonSerializer<T>
edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.ser.std.StdSerializer<T>
edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.ser.std.RawSerializer<T>
- All Implemented Interfaces:
JsonFormatVisitable
,SchemaAware
,Serializable
This is a simple dummy serializer that will just output raw values by calling
toString() on value to serialize.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.JsonSerializer
JsonSerializer.None
-
Field Summary
Fields inherited from class edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.ser.std.StdSerializer
_handledType
-
Constructor Summary
ConstructorDescriptionRawSerializer
(Class<?> cls) Constructor takes in expected type of values; but since caller typically cannot really provide actual type parameter, we will just take wild card and coerce type. -
Method Summary
Modifier and TypeMethodDescriptionvoid
acceptJsonFormatVisitor
(JsonFormatVisitorWrapper visitor, JavaType typeHint) Default implementation specifies no format.getSchema
(SerializerProvider provider, Type typeHint) Default implementation simply claims type is "string"; usually overriden by custom serializers.void
serialize
(T value, JsonGenerator jgen, SerializerProvider provider) Method that can be called to ask implementation to serialize values of type this serializer handles.void
serializeWithType
(T value, JsonGenerator g, SerializerProvider provider, TypeSerializer typeSer) Method that can be called to ask implementation to serialize values of type this serializer handles, using specified type serializer for embedding necessary type information.Methods inherited from class edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.ser.std.StdSerializer
_neitherNull, _nonEmpty, createSchemaNode, createSchemaNode, findAnnotatedContentSerializer, findContextualConvertingSerializer, findConvertingContentSerializer, findFormatFeature, findFormatOverrides, findIncludeOverrides, findPropertyFilter, getSchema, handledType, isDefaultSerializer, visitArrayFormat, visitArrayFormat, visitFloatFormat, visitIntFormat, visitIntFormat, visitStringFormat, visitStringFormat, wrapAndThrow, wrapAndThrow
Methods inherited from class edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.JsonSerializer
getDelegatee, isEmpty, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, unwrappingSerializer, usesObjectId, withFilterId
-
Constructor Details
-
RawSerializer
Constructor takes in expected type of values; but since caller typically cannot really provide actual type parameter, we will just take wild card and coerce type.
-
-
Method Details
-
serialize
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 classStdSerializer<T>
- Parameters:
value
- Value to serialize; can not be null.jgen
- Generator used to output resulting Json contentprovider
- Provider that can be used to get serializers for serializing Objects value contains, if any.- Throws:
IOException
-
serializeWithType
public void serializeWithType(T value, JsonGenerator g, SerializerProvider provider, TypeSerializer typeSer) throws IOException Description copied from class:JsonSerializer
Method that can be called to ask implementation to serialize values of type this serializer handles, using specified type serializer for embedding necessary type information.Default implementation will throw
UnsupportedOperationException
to indicate that proper type handling needs to be implemented.For simple datatypes written as a single scalar value (JSON String, Number, Boolean), implementation would look like:
// note: method to call depends on whether this type is serialized as JSON scalar, object or Array! typeSer.writeTypePrefixForScalar(value, gen); serialize(value, gen, provider); typeSer.writeTypeSuffixForScalar(value, gen);
and implementations for type serialized as JSON Arrays or Objects would differ slightly, asSTART-ARRAY
/END-ARRAY
andSTART-OBJECT
/END-OBJECT
pairs need to be properly handled with respect to serializing of contents.- Overrides:
serializeWithType
in classJsonSerializer<T>
- Parameters:
value
- Value to serialize; can not be null.g
- Generator used to output resulting Json contentprovider
- Provider that can be used to get serializers for serializing Objects value contains, if any.typeSer
- Type serializer to use for including type information- Throws:
IOException
-
getSchema
Description copied from class:StdSerializer
Default implementation simply claims type is "string"; usually overriden by custom serializers.- Specified by:
getSchema
in interfaceSchemaAware
- Overrides:
getSchema
in classStdSerializer<T>
- Parameters:
provider
- The serializer provider.typeHint
- A hint about the type.- Returns:
- Json-schema for this serializer.
-
acceptJsonFormatVisitor
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException Description copied from class:StdSerializer
Default implementation specifies no format. This behavior is usually overriden by custom serializers.- Specified by:
acceptJsonFormatVisitor
in interfaceJsonFormatVisitable
- Overrides:
acceptJsonFormatVisitor
in classStdSerializer<T>
typeHint
- Type of element (entity like property) being visited- Throws:
JsonMappingException
-