Skip to content

Mapper Features

cowtowncoder edited this page Apr 9, 2013 · 19 revisions

Jackson on/off features: MapperFeature

Jackson defines a set of per-mapper configuration, which can ONLY be defined before using ObjectMapper -- meaning that these settings can not be changed on-the-fly, on per-request basis. They configure fundamental POJO introspection details, and resulting built objects (serializers, deserializers, related) are heavily cached. If you need differing settings for these, you have to use separate ObjectMapper instances.

Settings can be divided in couple of loose categories, as follows.

Annotation handling

  • USE_ANNOTATIONS (default: true): whether any annotation processing is used or not -- may be useful on platforms where annotation-processing is hideously expensive

Introspection

  • AUTO_DETECT_CREATORS (default: true)
  • AUTO_DETECT_FIELDS (default: true)
  • AUTO_DETECT_GETTERS (default: true)
  • AUTO_DETECT_IS_GETTERS (default: true)
  • AUTO_DETECT_SETTERS (default: true)
  • REQUIRE_SETTERS_FOR_GETTERS(default: false)
  • USE_GETTERS_AS_SETTERS (default: true)
  • CAN_OVERRIDE_ACCESS_MODIFIERS (default: true)
  • INFER_PROPERTY_MUTATORS (default: true)
    • If enabled, mutators (field or setter used for changing POJO property value) may be inferred: that is, un-annotated, not-visible field or setter can be considered mutator if (and only if!) there is a fully visible or explicitly annotated (@JsonProperty) accessor (getter or field) with same logical name.
    • Enabled by default for convenience: may be disabled if fully explicit annotations are desired.

Name handling

  • SORT_PROPERTIES_ALPHABETICALLY (default: false)
  • USE_WRAPPER_NAME_AS_PROPERTY_NAME (default: false) (since [[JacksonRelease22 | 2.2)

Other

  • USE_STATIC_TYPING (default: false)
  • DEFAULT_VIEW_INCLUSION (default: true)
Clone this wiki locally