public abstract class AbstractMessageProxyGenerator extends Object implements Generator
| Modifier and Type | Field and Description |
|---|---|
protected static String |
GENERATED_PACKAGE_NAME |
protected static String |
MESSAGE_PROXY_PACKAGE_NAME |
static int |
MIN_VERSION_FOR_CHANGE_EVENT |
static int |
MIN_VERSION_FOR_CUSTOMER_USER_ACCESS |
static int |
MIN_VERSION_FOR_FEED_PLACES_LOCATION_DATA_EMAIL |
| Constructor and Description |
|---|
AbstractMessageProxyGenerator(Set<Integer> versions,
Messager messager,
Filer filer) |
| Modifier and Type | Method and Description |
|---|---|
void |
generate()
Generates a SearchResponseProxy for each version.
|
protected abstract void |
generate(com.squareup.javapoet.TypeSpec.Builder typeBuilder,
int version,
com.squareup.javapoet.ClassName proxiedClassName,
com.squareup.javapoet.ClassName proxiedBuilderClassName)
Generates the class content (methods etc.) required for the proxy implementation.
|
protected static void |
generateStringSetter(com.squareup.javapoet.TypeSpec.Builder typeBuilder,
com.squareup.javapoet.ClassName proxiedBuilderClassName,
String fullNameOfSetterMethod,
String filterStatement,
String updateStatement,
int version,
int minVersion)
Generates a setter for a string property.
|
protected static void |
generateStringSetter(com.squareup.javapoet.TypeSpec.Builder typeBuilder,
com.squareup.javapoet.ClassName proxiedBuilderClassName,
String fullNameOfSetterMethod,
String filterStatement,
String updateStatement,
int version,
int minVersionForType,
int minVersionForFilterAndUpdate)
Generates a setter for a string property.
|
protected abstract com.squareup.javapoet.ClassName |
getProxiedClassName(int version)
Gets the name of the class that this proxy is for.
|
protected com.squareup.javapoet.TypeName |
getProxyInterfaceParameterizedName(int version,
com.squareup.javapoet.ClassName interfaceRawType,
com.squareup.javapoet.ClassName proxiedClassName,
com.squareup.javapoet.ClassName proxiedBuilderClassName)
Gets the type of interface to be implemented.
|
protected abstract com.squareup.javapoet.ClassName |
getProxyInterfaceRawName()
Gets the name of the super interface that the generated proxy should implement.
|
protected static String |
getResourcesPackage(int version)
Gets the package where the API resource classes are located.
|
protected static String |
getServicesPackage(int version)
Gets the package where the API generated services classes are located.
|
public static final int MIN_VERSION_FOR_CUSTOMER_USER_ACCESS
public static final int MIN_VERSION_FOR_CHANGE_EVENT
public static final int MIN_VERSION_FOR_FEED_PLACES_LOCATION_DATA_EMAIL
protected static final String MESSAGE_PROXY_PACKAGE_NAME
protected static final String GENERATED_PACKAGE_NAME
public void generate()
protected abstract void generate(com.squareup.javapoet.TypeSpec.Builder typeBuilder,
int version,
com.squareup.javapoet.ClassName proxiedClassName,
com.squareup.javapoet.ClassName proxiedBuilderClassName)
protected com.squareup.javapoet.TypeName getProxyInterfaceParameterizedName(int version,
com.squareup.javapoet.ClassName interfaceRawType,
com.squareup.javapoet.ClassName proxiedClassName,
com.squareup.javapoet.ClassName proxiedBuilderClassName)
InterfaceRawTypeIt can be useful to override this in cases where the proxied type doesn't exist in a version. Rather than having a null proxy implementation (complicating client code), we can generate a default implementation which gracefully returns the builder unchanged.
protected static void generateStringSetter(com.squareup.javapoet.TypeSpec.Builder typeBuilder,
com.squareup.javapoet.ClassName proxiedBuilderClassName,
String fullNameOfSetterMethod,
String filterStatement,
String updateStatement,
int version,
int minVersion)
typeBuilder - the type which should contain the new setter.proxiedBuilderClassName - the builder for the type which is being proxied.fullNameOfSetterMethod - the name of the new method.filterStatement - a filter which should be applied prior to setting the new value. The
builder will be available from a variable named builder.updateStatement - a statement to update the value. The builder will be available from a
variable named builder.version - the version this setter is generated for.minVersion - the minimum version required to access the type, and execute filter + update
statements.protected static void generateStringSetter(com.squareup.javapoet.TypeSpec.Builder typeBuilder,
com.squareup.javapoet.ClassName proxiedBuilderClassName,
String fullNameOfSetterMethod,
String filterStatement,
String updateStatement,
int version,
int minVersionForType,
int minVersionForFilterAndUpdate)
typeBuilder - the type which should contain the new setter.proxiedBuilderClassName - the builder for the type which is being proxied.fullNameOfSetterMethod - the name of the new method.filterStatement - a filter which should be applied prior to setting the new value. The
builder will be available from a variable named builder.updateStatement - a statement to update the value. The builder will be available from a
variable named builder.version - the version this setter is generated for.minVersionForFilterAndUpdate - the minimum version required to access the type.minVersionForFilterAndUpdate - the minimum version required to support the filter + update
statements.protected abstract com.squareup.javapoet.ClassName getProxyInterfaceRawName()
protected abstract com.squareup.javapoet.ClassName getProxiedClassName(int version)
protected static String getServicesPackage(int version)
protected static String getResourcesPackage(int version)
Copyright © 2020. All rights reserved.