Annotation Type PathVariable


@Retention(CLASS) @Target(PARAMETER) public @interface PathVariable

Binds a {name} segment of the path to this parameter.

A missing value binds to the default below, or to null when the parameter is not required. It is never a server error unless required says so.

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The name to bind from.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Used when the request omits it.
    boolean
    Whether a request without it is rejected.
  • Element Details

    • value

      String value
      The name to bind from. REQUIRED, and deliberately so: it cannot default to the parameter's own name because a Java parameter name only survives compilation when the application is built with -parameters, which is the application's build to decide and not this one's. An annotation that promised the default would compile fine and then fail at packaging, for every developer who took it at its word.
    • required

      boolean required
      Whether a request without it is rejected.
      Default:
      true
    • defaultValue

      String defaultValue
      Used when the request omits it.
      Default:
      ""