public class VersionCatalogCodeGenerator extends Object implements Generator
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 and Description |
|---|
VersionCatalogCodeGenerator(Set<Integer> versions,
String catalogName,
Messager messager,
Filer filer)
Creates an instance of the generator.
|
| Modifier and Type | Method and Description |
|---|---|
void |
generate()
Generates the code for the VersionCatalog class and writes the file.
|
public VersionCatalogCodeGenerator(Set<Integer> versions, String catalogName, Messager messager, Filer filer)
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.Copyright © 2020. All rights reserved.