Annotation Type API


  • @Target({TYPE,METHOD,CONSTRUCTOR,FIELD,PACKAGE})
    @Retention(RUNTIME)
    @Documented
    public @interface API
    @API is used to annotate public types, methods, constructors, and fields within a framework or application in order to publish their status() and level of stability and to indicate how they are intended to be used by consumers() of the API.

    If @API is present on a type, it is considered to hold for all public members of the type as well. However, a member of such an annotated type is allowed to declare a API.Status of lower stability. For example, a class annotated with @API(status = STABLE) may declare a constructor for internal usage that is annotated with @API(status = INTERNAL).

    If @API is present on a package, it is considered to hold for all public types in its package. The same rules for lowered stability apply as if they were specified on a type.

    Since:
    1.0
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      API.Status status
      The current status of the API.
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      String[] consumers
      List of packages belonging to intended consumers.
      String since
      The version of the API when the status() was last changed.
      • since

        String since
        The version of the API when the status() was last changed.

        Defaults to an empty string, signifying that the since version is unknown.

        Default:
        ""
      • consumers

        String[] consumers
        List of packages belonging to intended consumers.

        The supplied packages can be fully qualified package names or patterns containing asterisks that will be used as wildcards.

        Defaults to "*", signifying that the API is intended to be consumed by any package.

        Default:
        {"*"}