Class VersionCatalogCodeGenerator

  • All Implemented Interfaces:
    Generator

    public class VersionCatalogCodeGenerator
    extends java.lang.Object
    implements Generator
    Generates code for and writes the VersionCatalog class, which contains a method to retrieve a set of Version objects, one for each available version of the Google Ads library.

    Example generated code snippets:

      
      public class VersionCatalog {
        protected static ImmutableSet getCatalog() throws IllegalAccessException,
          InstantiationException {
        ImmutableSet.Builder builder = ImmutableSet.builder();
          builder.add(new Version(
            "v1",
            com.google.ads.googleads.v1.errors.GoogleAdsException.Factory.class.newInstance(),
            com.google.ads.googleads.v1.services.GoogleAdsVersion.class));
           builder.add(new Version(
            "v2",
            com.google.ads.googleads.v2.errors.GoogleAdsException.Factory.class.newInstance(),
            com.google.ads.googleads.v2.services.GoogleAdsVersion.class));
          return builder.build();
        }
      }
      
      
    • Constructor Summary

      Constructors 
      Constructor Description
      VersionCatalogCodeGenerator​(java.util.Set<java.lang.Integer> versions, java.lang.String catalogName, javax.annotation.processing.Messager messager, javax.annotation.processing.Filer filer)
      Creates an instance of the generator.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void generate()
      Generates the code for the VersionCatalog class and writes the file.
      • Methods inherited from class java.lang.Object

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

      • VersionCatalogCodeGenerator

        public VersionCatalogCodeGenerator​(java.util.Set<java.lang.Integer> versions,
                                           java.lang.String catalogName,
                                           javax.annotation.processing.Messager messager,
                                           javax.annotation.processing.Filer filer)
        Creates an instance of the generator.
        Parameters:
        versions - available versions of the Google Ads library.
        catalogName - the catalogName parameter found in the VersionDescriptor annotation that will be used to namespace the output classname (can be an empty string).
        messager - the processing environment's messager.
        filer - the processing environment's filer.
    • Method Detail

      • generate

        public void generate()
        Generates the code for the VersionCatalog class and writes the file.
        Specified by:
        generate in interface Generator