Package com.google.auto.common
Class GeneratedAnnotations
java.lang.Object
com.google.auto.common.GeneratedAnnotations
Utility methods for writing
@Generated
annotations.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<TypeElement>
generatedAnnotation
(Elements elements) Deprecated.static Optional<TypeElement>
generatedAnnotation
(Elements elements, SourceVersion sourceVersion) Returns the element corresponding to the@Generated
annotation present at the targetSourceVersion
.
-
Constructor Details
-
GeneratedAnnotations
private GeneratedAnnotations()
-
-
Method Details
-
generatedAnnotation
Deprecated.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 thenjavax.annotation.Generated
. Returns whichever is in the classpath (or modulepath), orOptional.empty()
if neither is. -
generatedAnnotation
public static Optional<TypeElement> generatedAnnotation(Elements elements, SourceVersion sourceVersion) Returns the element corresponding to the@Generated
annotation present at the targetSourceVersion
.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.
-
generatedAnnotation(Elements, SourceVersion)