Class Jackson2CodecSupport
- java.lang.Object
- org.springframework.http.codec.json.Jackson2CodecSupport
- Direct Known Subclasses:
AbstractJackson2Decoder,AbstractJackson2Encoder
public abstract class Jackson2CodecSupport extends Object
Base class providing support methods for Jackson 2.9 encoding and decoding.- Since:
- 5.0
- Author:
- Sebastien Deleuze, Rossen Stoyanchev
Field Summary
Fields Modifier and Type Field Description static StringJSON_VIEW_HINTThe key for the hint to specify a "JSON View" for encoding or decoding with the value expected to be aClass.protected Loglogger
Constructor Summary
Constructors Modifier Constructor Description protectedJackson2CodecSupport(ObjectMapper objectMapper, MimeType... mimeTypes)Constructor with a JacksonObjectMapperto use.
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract <A extends Annotation>
AgetAnnotation(MethodParameter parameter, Class<A> annotType)protected Map<String,Object>getHints(ResolvableType resolvableType)protected JavaTypegetJavaType(Type type, Class<?> contextClass)protected List<MimeType>getMimeTypes()Subclasses should expose this as "decodable" or "encodable" mime types.ObjectMappergetObjectMapper()protected MethodParametergetParameter(ResolvableType type)protected booleansupportsMimeType(MimeType mimeType)
Field Detail
JSON_VIEW_HINT
public static final String JSON_VIEW_HINT
The key for the hint to specify a "JSON View" for encoding or decoding with the value expected to be aClass.- See Also:
- Jackson JSON Views
Constructor Detail
Jackson2CodecSupport
protected Jackson2CodecSupport(ObjectMapper objectMapper, MimeType... mimeTypes)
Constructor with a JacksonObjectMapperto use.
Method Detail
getObjectMapper
public ObjectMapper getObjectMapper()
getMimeTypes
protected List<MimeType> getMimeTypes()
Subclasses should expose this as "decodable" or "encodable" mime types.
supportsMimeType
protected boolean supportsMimeType(@Nullable MimeType mimeType)
getJavaType
protected JavaType getJavaType(Type type, @Nullable Class<?> contextClass)
getHints
protected Map<String,Object> getHints(ResolvableType resolvableType)
getParameter
@Nullable protected MethodParameter getParameter(ResolvableType type)
getAnnotation
@Nullable protected abstract <A extends Annotation> A getAnnotation(MethodParameter parameter, Class<A> annotType)