Annotation Interface Example


Identifies examples for POJOs.

Can be used in the following locations:

  • Static method that returns an example of the POJO.
  • Static field that contains an example of the POJO.
  • On a class.
  • @Rest-annotated classes and @RestOp-annotated methods when used with @ExampleApply.
Examples:

// On a static method. public class A { @Example public static A example() { return new A().foo("bar").baz(123); } ... } // On a static field. public class B { @Example public static B EXAMPLE = new B().foo("bar").baz(123); ... } // On a class. @Example("{foo:'bar',baz:123}") public class C {...}

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Optional description for the exposed API.
    An example of a POJO class.
  • Element Details

    • description

      Optional description for the exposed API.
      Returns:
      The annotation value.
      Since:
      9.2.0
      Default:
      {}
    • value

      An example of a POJO class.

      Format is Lax-JSON.

      This value is only used when the annotation is used on a type.

      Returns:
      The annotation value.
      Default:
      ""