Annotation Interface Generated


@Documented @Retention(SOURCE) @Target({TYPE,PACKAGE,MODULE}) public @interface Generated
Indicates that the source file containing the annotated entity has been generated automatically.

This annotation should be used on top-level entities (top-level classes, package declarations, module declarations) only. It applies to the whole content of the source file.

This annotation serves two distinct but interconnected purposes:

  • Storing metadata that allow reconstruction of the generating process;
  • letting programmers know that, depending on the build sgtrategy,
    • either the source file should not be edited manually, since repeating the generating process is likely to overwrite the contents,
    • or the source file has been edited manually after its generation, and the generating process should not be repeated.
Since:
1.1.1
See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Returns the name of the generator.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Indicates that the source file containing the annotated entity has been edited manually after generation.
    Returns a description of the type of the generator.
    Returns a list of parameters that have influenced the generation process.
    Returns a timestamp of the generation process.
    Returns a desciption of the version of the generator.
  • Element Details

    • generator

      String generator
      Returns the name of the generator. If the generator is implemented in Java, then this should be a valid module, package or class name; the largest entity that identifies the generator uniquely.
      Returns:
      the name of the generator
    • generatorType

      String generatorType
      Returns a description of the type of the generator. If the generator is a Java class, package or module, then the value should be "class", "package" or "module", respectively. For other generators, the value should be some other, context-dependent value.
      Returns:
      the type of the generator
      Since:
      1.3
      Default:
      ""
    • version

      String version
      Returns a desciption of the version of the generator. Depending of the nature of the generator software, this can be a version number, a timestamp in ISO 8601 format, or some other data. The empty string indicates that no version information is available.
      Returns:
      the version of the generator
      Default:
      ""
    • timestamp

      String timestamp
      Returns a timestamp of the generation process. This should be in ISO 8601 format, with precision appropriate to the context. The empty string indicates that no timestamp information is available.
      Returns:
      the timestamp of generation
      Default:
      ""
    • parameters

      String[] parameters
      Returns a list of parameters that have influenced the generation process.
      Returns:
      the parameters of generation
      Default:
      {}
    • edited

      boolean edited
      Indicates that the source file containing the annotated entity has been edited manually after generation.

      If this flag is set to true, it also implies that work may be lost if the generation process is executed again and overwrites the file.

      Returns:
      true if the source file containing the annotated entity has been edited manually; false if the content is exactly as emitted by the generator.
      Since:
      2.1
      Default:
      false