Class GeneratedAnnotationSpecs


  • public final class GeneratedAnnotationSpecs
    extends java.lang.Object
    Utility methods for writing @Generated annotations using JavaPoet.
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static java.util.Optional<com.squareup.javapoet.AnnotationSpec> generatedAnnotationSpec​(javax.lang.model.util.Elements elements, java.lang.Class<?> processorClass)
      static java.util.Optional<com.squareup.javapoet.AnnotationSpec> generatedAnnotationSpec​(javax.lang.model.util.Elements elements, java.lang.Class<?> processorClass, java.lang.String comments)
      static java.util.Optional<com.squareup.javapoet.AnnotationSpec> generatedAnnotationSpec​(javax.lang.model.util.Elements elements, javax.lang.model.SourceVersion sourceVersion, java.lang.Class<?> processorClass)
      Returns @Generated("processorClass") for the target SourceVersion.
      static java.util.Optional<com.squareup.javapoet.AnnotationSpec> generatedAnnotationSpec​(javax.lang.model.util.Elements elements, javax.lang.model.SourceVersion sourceVersion, java.lang.Class<?> processorClass, java.lang.String comments)
      Returns @Generated(value = "processorClass", comments = "comments") for the target SourceVersion.
      private static java.util.Optional<com.squareup.javapoet.AnnotationSpec.Builder> generatedAnnotationSpecBuilder​(javax.lang.model.util.Elements elements, java.lang.Class<?> processorClass)  
      private static java.util.Optional<com.squareup.javapoet.AnnotationSpec.Builder> generatedAnnotationSpecBuilder​(javax.lang.model.util.Elements elements, javax.lang.model.SourceVersion sourceVersion, java.lang.Class<?> processorClass)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GeneratedAnnotationSpecs

        private GeneratedAnnotationSpecs()
    • Method Detail

      • generatedAnnotationSpec

        @Deprecated
        public static java.util.Optional<com.squareup.javapoet.AnnotationSpec> generatedAnnotationSpec​(javax.lang.model.util.Elements elements,
                                                                                                       java.lang.Class<?> processorClass)
        Returns @Generated("processorClass") if either javax.annotation.processing.Generated or javax.annotation.Generated is available at compile time.
      • generatedAnnotationSpec

        @Deprecated
        public static java.util.Optional<com.squareup.javapoet.AnnotationSpec> generatedAnnotationSpec​(javax.lang.model.util.Elements elements,
                                                                                                       java.lang.Class<?> processorClass,
                                                                                                       java.lang.String comments)
        Returns @Generated(value = "processorClass", comments = "comments") if either javax.annotation.processing.Generated or javax.annotation.Generated is available at compile time.
      • generatedAnnotationSpec

        public static java.util.Optional<com.squareup.javapoet.AnnotationSpec> generatedAnnotationSpec​(javax.lang.model.util.Elements elements,
                                                                                                       javax.lang.model.SourceVersion sourceVersion,
                                                                                                       java.lang.Class<?> processorClass)
        Returns @Generated("processorClass") for 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.

      • generatedAnnotationSpec

        public static java.util.Optional<com.squareup.javapoet.AnnotationSpec> generatedAnnotationSpec​(javax.lang.model.util.Elements elements,
                                                                                                       javax.lang.model.SourceVersion sourceVersion,
                                                                                                       java.lang.Class<?> processorClass,
                                                                                                       java.lang.String comments)
        Returns @Generated(value = "processorClass", comments = "comments") for 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.

      • generatedAnnotationSpecBuilder

        private static java.util.Optional<com.squareup.javapoet.AnnotationSpec.Builder> generatedAnnotationSpecBuilder​(javax.lang.model.util.Elements elements,
                                                                                                                       java.lang.Class<?> processorClass)
      • generatedAnnotationSpecBuilder

        private static java.util.Optional<com.squareup.javapoet.AnnotationSpec.Builder> generatedAnnotationSpecBuilder​(javax.lang.model.util.Elements elements,
                                                                                                                       javax.lang.model.SourceVersion sourceVersion,
                                                                                                                       java.lang.Class<?> processorClass)