public abstract class DatabindContext
extends java.lang.Object
DeserializationContext and
SerializerProvider, context objects passed through data-binding
process. Designed so that some of implementations can rely on shared
aspects like access to secondary contextual objects like type factories
or handler instantiators.| Modifier and Type | Field and Description |
|---|---|
private static int |
MAX_ERROR_STR_LEN
Let's limit length of error messages, for cases where underlying data
may be very large -- no point in spamming logs with megabytes of meaningless
data.
|
| Constructor and Description |
|---|
DatabindContext() |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
_colonConcat(java.lang.String msgBase,
java.lang.String extra) |
protected java.lang.String |
_desc(java.lang.String desc) |
protected java.lang.String |
_format(java.lang.String msg,
java.lang.Object... msgArgs) |
protected java.lang.String |
_quotedString(java.lang.String desc) |
protected java.lang.String |
_truncate(java.lang.String desc) |
abstract boolean |
canOverrideAccessModifiers()
Convenience method for accessing serialization view in use (if any); equivalent to:
|
JavaType |
constructSpecializedType(JavaType baseType,
java.lang.Class<?> subclass)
Convenience method for constructing subtypes, retaining generic
type parameter (if any)
|
JavaType |
constructType(java.lang.reflect.Type type)
Convenience method for constructing
JavaType for given JDK
type (usually Class) |
Converter<java.lang.Object,java.lang.Object> |
converterInstance(Annotated annotated,
java.lang.Object converterDef)
Helper method to use to construct a
Converter, given a definition
that may be either actual converter instance, or Class for instantiating one. |
abstract java.lang.Class<?> |
getActiveView()
Accessor for locating currently active view, if any;
returns null if no view has been set.
|
abstract AnnotationIntrospector |
getAnnotationIntrospector()
Convenience method for accessing serialization view in use (if any); equivalent to:
|
abstract java.lang.Object |
getAttribute(java.lang.Object key)
Method for accessing attributes available in this context.
|
abstract MapperConfig<?> |
getConfig()
Accessor to currently active configuration (both per-request configs
and per-mapper config).
|
abstract com.fasterxml.jackson.annotation.JsonFormat.Value |
getDefaultPropertyFormat(java.lang.Class<?> baseType) |
abstract java.util.Locale |
getLocale() |
abstract java.util.TimeZone |
getTimeZone() |
abstract TypeFactory |
getTypeFactory() |
protected abstract JsonMappingException |
invalidTypeIdException(JavaType baseType,
java.lang.String typeId,
java.lang.String extraDesc)
Helper method for constructing exception to indicate that given type id
could not be resolved to a valid subtype of specified base type.
|
abstract boolean |
isEnabled(MapperFeature feature)
Convenience method for checking whether specified serialization
feature is enabled or not.
|
com.fasterxml.jackson.annotation.ObjectIdGenerator<?> |
objectIdGeneratorInstance(Annotated annotated,
ObjectIdInfo objectIdInfo) |
com.fasterxml.jackson.annotation.ObjectIdResolver |
objectIdResolverInstance(Annotated annotated,
ObjectIdInfo objectIdInfo) |
<T> T |
reportBadDefinition(java.lang.Class<?> type,
java.lang.String msg) |
abstract <T> T |
reportBadDefinition(JavaType type,
java.lang.String msg)
Helper method called to indicate a generic problem that stems from type
definition(s), not input data, or input/output state; typically this
means throwing a
InvalidDefinitionException. |
JavaType |
resolveSubType(JavaType baseType,
java.lang.String subClass)
Lookup method called when code needs to resolve class name from input;
usually simple lookup
|
abstract DatabindContext |
setAttribute(java.lang.Object key,
java.lang.Object value)
Method for setting per-call value of given attribute.
|
private static final int MAX_ERROR_STR_LEN
public abstract MapperConfig<?> getConfig()
public abstract AnnotationIntrospector getAnnotationIntrospector()
getConfig().getAnnotationIntrospector();
public abstract boolean isEnabled(MapperFeature feature)
getConfig().isEnabled(feature);
public abstract boolean canOverrideAccessModifiers()
getConfig().canOverrideAccessModifiers();
public abstract java.lang.Class<?> getActiveView()
public abstract java.util.Locale getLocale()
public abstract java.util.TimeZone getTimeZone()
public abstract com.fasterxml.jackson.annotation.JsonFormat.Value getDefaultPropertyFormat(java.lang.Class<?> baseType)
public abstract java.lang.Object getAttribute(java.lang.Object key)
ObjectReader or ObjectWriter have lower
precedence.key - Key of the attribute to getpublic abstract DatabindContext setAttribute(java.lang.Object key, java.lang.Object value)
key - Key of the attribute to setvalue - Value to set attribute topublic JavaType constructType(java.lang.reflect.Type type)
JavaType for given JDK
type (usually Class)public JavaType constructSpecializedType(JavaType baseType, java.lang.Class<?> subclass)
public JavaType resolveSubType(JavaType baseType, java.lang.String subClass) throws JsonMappingException
JsonMappingExceptionprotected abstract JsonMappingException invalidTypeIdException(JavaType baseType, java.lang.String typeId, java.lang.String extraDesc)
Note that most of the time this method should NOT be called directly: instead,
method handleUnknownTypeId() should be called which will call this method
if necessary.
public abstract TypeFactory getTypeFactory()
public com.fasterxml.jackson.annotation.ObjectIdGenerator<?> objectIdGeneratorInstance(Annotated annotated, ObjectIdInfo objectIdInfo) throws JsonMappingException
JsonMappingExceptionpublic com.fasterxml.jackson.annotation.ObjectIdResolver objectIdResolverInstance(Annotated annotated, ObjectIdInfo objectIdInfo)
public Converter<java.lang.Object,java.lang.Object> converterInstance(Annotated annotated, java.lang.Object converterDef) throws JsonMappingException
Converter, given a definition
that may be either actual converter instance, or Class for instantiating one.JsonMappingExceptionpublic abstract <T> T reportBadDefinition(JavaType type, java.lang.String msg) throws JsonMappingException
InvalidDefinitionException.JsonMappingExceptionpublic <T> T reportBadDefinition(java.lang.Class<?> type,
java.lang.String msg)
throws JsonMappingException
JsonMappingExceptionprotected final java.lang.String _format(java.lang.String msg,
java.lang.Object... msgArgs)
protected final java.lang.String _truncate(java.lang.String desc)
protected java.lang.String _quotedString(java.lang.String desc)
protected java.lang.String _colonConcat(java.lang.String msgBase,
java.lang.String extra)
protected java.lang.String _desc(java.lang.String desc)