Class ApiConfigAnnotationReader
- java.lang.Object
-
- com.google.api.server.spi.config.annotationreader.ApiConfigAnnotationReader
-
- All Implemented Interfaces:
ApiConfigSource
public class ApiConfigAnnotationReader extends Object implements ApiConfigSource
Reads annotations on endpoint classes to produce an api configuration.- Author:
- Eric Orth
-
-
Constructor Summary
Constructors Constructor Description ApiConfigAnnotationReader()ApiConfigAnnotationReader(Map<String,Class<? extends Annotation>> annotationTypes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisStaticConfig(ApiConfig config)Returnstrueiff configuration from this source is static and cannot change between calls to this source.voidloadEndpointClass(ServiceContext serviceContext, Class<?> endpointClass, ApiConfig config)Loads all configuration data for the endpoint class from the configuration source intoconfig.voidloadEndpointMethods(ServiceContext serviceContext, Class<?> endpointClass, ApiClassConfig.MethodConfigMap methodConfigMap)Loads all configuration data for the methods of the endpoint class from the configuration source intomethodConfigMap.protected voidreadApiAuth(com.google.api.server.spi.config.annotationreader.ApiAuthAnnotationConfig config, Annotation auth)Converts the auth config from the auth annotation.protected voidreadApiNamespace(ApiNamespaceAnnotationConfig config, Annotation namespace)
-
-
-
Constructor Detail
-
ApiConfigAnnotationReader
public ApiConfigAnnotationReader() throws ClassNotFoundException- Throws:
ClassNotFoundException
-
ApiConfigAnnotationReader
public ApiConfigAnnotationReader(Map<String,Class<? extends Annotation>> annotationTypes)
-
-
Method Detail
-
loadEndpointClass
public void loadEndpointClass(ServiceContext serviceContext, Class<?> endpointClass, ApiConfig config) throws ApiConfigException
Description copied from interface:ApiConfigSourceLoads all configuration data for the endpoint class from the configuration source intoconfig. Does not include configuration data for the endpoint methods.- Specified by:
loadEndpointClassin interfaceApiConfigSource- Parameters:
serviceContext- Provides context regarding GAE application settings.endpointClass- Class object whose configuration data is being loaded.config- Configuration as loaded so far with defaults and any already-read configurations. The ApiConfigSource will overwrite any values with those set by its config source.- Throws:
ApiConfigException
-
loadEndpointMethods
public void loadEndpointMethods(ServiceContext serviceContext, Class<?> endpointClass, ApiClassConfig.MethodConfigMap methodConfigMap) throws ApiConfigException
Description copied from interface:ApiConfigSourceLoads all configuration data for the methods of the endpoint class from the configuration source intomethodConfigMap.- Specified by:
loadEndpointMethodsin interfaceApiConfigSource- Parameters:
serviceContext- Provides context regarding GAE application settings.endpointClass- Class object whose configuration data is being loaded.methodConfigMap- A map of endpoint method to its configuration data. This data will can be read and/or overwritten by this method.- Throws:
ApiConfigException
-
isStaticConfig
public boolean isStaticConfig(ApiConfig config)
Description copied from interface:ApiConfigSourceReturnstrueiff configuration from this source is static and cannot change between calls to this source. This would be true, for example, when the config is loaded from annotations on the java classes.- Specified by:
isStaticConfigin interfaceApiConfigSource- Parameters:
config- Configuration as loaded so far with defaults and any already-read configurations.
-
readApiAuth
protected void readApiAuth(com.google.api.server.spi.config.annotationreader.ApiAuthAnnotationConfig config, Annotation auth) throws NoSuchMethodException, IllegalAccessException, InvocationTargetExceptionConverts the auth config from the auth annotation. Subclasses may override to add additional information to the auth config.
-
readApiNamespace
protected void readApiNamespace(ApiNamespaceAnnotationConfig config, Annotation namespace) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
-
-