Annotation Interface Default


Specifies the default value of an optional parameter.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The default value to use as a fallback when the request parameter is not provided or has an empty value.
  • Element Details

    • value

      String value
      The default value to use as a fallback when the request parameter is not provided or has an empty value. When Default annotation exists but value() is not specified, null value would be set if the parameter is not present in the request.

      When Default annotation exists and value() is not specified, the parameter may be present in the request without a value (e.g. /foo?bar=). In this case, the behavior depends on the java type with which the parameter will be bound to.

      Actions
      TypeAction
      Primitive typesAn IllegalArgumentException will be thrown
      StringAn empty string "" will be set
      List or SetAn empty collection will be set
      OtherThe null value will be set

      Default annotation is not allowed for a path variable. If a user uses Default annotation on a path variable, IllegalArgumentException would be raised.

      Default:
      "\n\t\t\n\t\t\n\u0000\u0001\u0002\n\t\t\t\t\n"