Top Description Constructors Methods
com.google.auto.common

public final Class GeneratedAnnotations

extends Object
Class Inheritance
Imports
java.util.Optional, javax.lang.model.SourceVersion, javax.lang.model.element.TypeElement, javax.lang.model.util.Elements

Utility methods for writing @Generated annotations.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Optional<TypeElement>
generatedAnnotation(Elements elements)

Returns the element corresponding to the version of the @Generated annotation present in the compile-time class- or module-path.
public static Optional<TypeElement>
generatedAnnotation(Elements elements, SourceVersion sourceVersion)

Returns the element corresponding to the @Generated annotation present at the target SourceVersion.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

GeneratedAnnotationsback to summary
private GeneratedAnnotations()

Method Detail

generatedAnnotationback to summary
public static Optional<TypeElement> generatedAnnotation(Elements elements)

Returns the element corresponding to the version of the @Generated annotation present in the compile-time class- or module-path.

First looks for javax.annotation.processing.Generated, and then javax.annotation.Generated. Returns whichever is in the classpath (or modulepath), or Optional#empty() if neither is.

Annotations
@Deprecated
generatedAnnotationback to summary
public static Optional<TypeElement> generatedAnnotation(Elements elements, SourceVersion sourceVersion)

Returns the element corresponding to the @Generated annotation present at the target SourceVersion.

Returns javax.annotation.processing.Generated for JDK 9 and newer, javax.annotation.Generated for earlier releases, and Optional#empty()} if the annotation is not available.