public class JsonViewSerializer extends com.fasterxml.jackson.databind.JsonSerializer<JsonView>
| Modifier and Type | Field and Description |
|---|---|
static boolean |
log |
| Constructor and Description |
|---|
JsonViewSerializer() |
JsonViewSerializer(int maxCacheSize) |
| Modifier and Type | Method and Description |
|---|---|
<T> void |
registerCustomSerializer(Class<T> cls,
com.fasterxml.jackson.databind.JsonSerializer<T> forType)
Registering custom serializer allows to the JSonView to deal with custom serializations for certains field types.
This way you could register for instance a JODA serialization as a DateTimeSerializer. |
void |
serialize(JsonView result,
com.fasterxml.jackson.core.JsonGenerator jgen,
com.fasterxml.jackson.databind.SerializerProvider serializers) |
void |
setDefaultMatcherBehavior(MatcherBehavior defaultMatcherBehavior)
Set the default matcher behavior to be used if the
JsonView object to
be serialized does not specify one. |
void |
unregisterCustomSerializer(Class<?> cls)
Unregister a previously registered serializer.
|
public JsonViewSerializer()
public JsonViewSerializer(int maxCacheSize)
public <T> void registerCustomSerializer(Class<T> cls, com.fasterxml.jackson.databind.JsonSerializer<T> forType)
JsonViewSupportFactoryBean bean = new JsonViewSupportFactoryBean( mapper );
bean.registerCustomSerializer( DateTime.class, new DateTimeSerializer() );
T - Type class of the serializercls - Class The class type you want to add a custom serializerforType - JsonSerializer The serializer you want to apply for that typepublic void unregisterCustomSerializer(Class<?> cls)
cls - The class type the serializer was registered forpublic void setDefaultMatcherBehavior(MatcherBehavior defaultMatcherBehavior)
JsonView object to
be serialized does not specify one.defaultMatcherBehavior - The default behavior to usepublic void serialize(JsonView result, com.fasterxml.jackson.core.JsonGenerator jgen, com.fasterxml.jackson.databind.SerializerProvider serializers) throws IOException
serialize in class com.fasterxml.jackson.databind.JsonSerializer<JsonView>IOExceptionCopyright © 2021. All rights reserved.