com.fasterxml.jackson.databind

Class DatabindContext

    • Constructor Detail

      • DatabindContext

        public DatabindContext()
    • Method Detail

      • getConfig

        public abstract MapperConfig<?> getConfig()
        Accessor to currently active configuration (both per-request configs and per-mapper config).
      • getAnnotationIntrospector

        public abstract AnnotationIntrospector getAnnotationIntrospector()
        Convenience method for accessing serialization view in use (if any); equivalent to:
           getConfig().getAnnotationIntrospector();
        
      • isEnabled

        public abstract boolean isEnabled(MapperFeature feature)
        Convenience method for checking whether specified serialization feature is enabled or not. Shortcut for:
          getConfig().isEnabled(feature);
        
      • canOverrideAccessModifiers

        public abstract boolean canOverrideAccessModifiers()
        Convenience method for accessing serialization view in use (if any); equivalent to:
           getConfig().canOverrideAccessModifiers();
        
      • getActiveView

        public abstract Class<?> getActiveView()
        Accessor for locating currently active view, if any; returns null if no view has been set.
      • getLocale

        public abstract Locale getLocale()
        Since:
        2.6
      • getTimeZone

        public abstract TimeZone getTimeZone()
        Since:
        2.6
      • getDefaultPropertyFormat

        public abstract JsonFormat.Value getDefaultPropertyFormat(Class<?> baseType)
        Since:
        2.7
      • getAttribute

        public abstract Object getAttribute(Object key)
        Method for accessing attributes available in this context. Per-call attributes have highest precedence; attributes set via ObjectReader or ObjectWriter have lower precedence.
        Parameters:
        key - Key of the attribute to get
        Returns:
        Value of the attribute, if any; null otherwise
        Since:
        2.3
      • setAttribute

        public abstract DatabindContext setAttribute(Object key,
                                   Object value)
        Method for setting per-call value of given attribute. This will override any previously defined value for the attribute within this context.
        Parameters:
        key - Key of the attribute to set
        value - Value to set attribute to
        Returns:
        This context object, to allow chaining
        Since:
        2.3
      • constructType

        public JavaType constructType(Type type)
        Convenience method for constructing JavaType for given JDK type (usually Class)
      • constructSpecializedType

        public JavaType constructSpecializedType(JavaType baseType,
                                        Class<?> subclass)
        Convenience method for constructing subtypes, retaining generic type parameter (if any)
      • invalidTypeIdException

        protected abstract JsonMappingException invalidTypeIdException(JavaType baseType,
                                                  String typeId,
                                                  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. Most commonly called during polymorphic deserialization.

        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.

        Since:
        2.9
      • getTypeFactory

        public abstract TypeFactory getTypeFactory()
      • _truncate

        protected final String _truncate(String desc)
        Since:
        2.9
      • _quotedString

        protected String _quotedString(String desc)
        Since:
        2.9
      • _calcName

        protected String _calcName(Class<?> cls)
        Since:
        2.9

Copyright © 2008–2017 FasterXML. All rights reserved.