Annotation Type JacksonInject


  • @Target({ANNOTATION_TYPE,METHOD,FIELD,PARAMETER})
    @Retention(RUNTIME)
    public @interface JacksonInject
    Jackson-specific annotation used for indicating that value of annotated property will be "injected", i.e. set based on value configured by ObjectMapper or ObjectReader (usually on per-call basis). Usually property is not deserialized from JSON, although it is possible to have injected value as default and still allow optional override from JSON.
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      OptBoolean optional
      Whether to throw an exception when the value to inject is not found from ObjectMapper or ObjectReader used for reading.
      OptBoolean useInput
      Whether matching value from input (if any) is used for annotated property or not; if disabled (OptBoolean.FALSE), input value (if any) will be ignored; otherwise it will override injected value.
      java.lang.String value
      Logical id of the value to inject; if not specified (or specified as empty String), will use id based on declared type of property (NOT name of property).
    • Element Detail

      • value

        java.lang.String value
        Logical id of the value to inject; if not specified (or specified as empty String), will use id based on declared type of property (NOT name of property).
        Returns:
        Logical id of the value to inject
        Default:
        ""
      • useInput

        OptBoolean useInput
        Whether matching value from input (if any) is used for annotated property or not; if disabled (OptBoolean.FALSE), input value (if any) will be ignored; otherwise it will override injected value.

        Default is OptBoolean.DEFAULT, which translates to OptBoolean.TRUE.

        Returns:
        OptBoolean.TRUE to enable use of value from input instead of injected value, if available; OptBoolean.FALSE if injected value will always be used regardless of input.
        Default:
        com.fasterxml.jackson.annotation.OptBoolean.DEFAULT
      • optional

        OptBoolean optional
        Whether to throw an exception when the value to inject is not found from ObjectMapper or ObjectReader used for reading.

        Default is OptBoolean.DEFAULT for backwards-compatibility: in this case mapper/reader defaults are used (which in turn are same as {code OptBoolean.FALSE}).

        Returns:
        OptBoolean.FALSE to throw an exception; OptBoolean.TRUE to avoid throwing it; or OptBoolean.DEFAULT to use configure defaults (which are same as OptBoolean.FALSE for Jackson 2.x)
        Since:
        2.20
        Default:
        com.fasterxml.jackson.annotation.OptBoolean.DEFAULT