Class ServiceLayerCache
- java.lang.Object
- 
- com.google.web.bindery.requestfactory.server.ServiceLayer
- 
- com.google.web.bindery.requestfactory.server.ServiceLayerDecorator
- 
- com.google.web.bindery.requestfactory.server.ServiceLayerCache
 
 
 
- 
 class ServiceLayerCache extends ServiceLayerDecorator A cache for idempotent methods inServiceLayer. The caching is separate fromReflectiveServiceLayerso that the cache can be applied to any decorators injected by the user.
- 
- 
Field Summary- 
Fields inherited from class com.google.web.bindery.requestfactory.server.ServiceLayerDecoratornext
 - 
Fields inherited from class com.google.web.bindery.requestfactory.server.ServiceLayertop
 
- 
 - 
Constructor SummaryConstructors Constructor Description ServiceLayerCache()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends Locator<?,?>>
 TcreateLocator(java.lang.Class<T> clazz)Create an instance of the requestedLocatortype.java.lang.ObjectcreateServiceInstance(java.lang.Class<? extends RequestContext> requestContext)Create an instance of a service object that can be used as the target for the given method invocation.java.lang.ClassLoadergetDomainClassLoader()Returns the ClassLoader that should be used when attempting to access domain classes or resources.java.lang.reflect.MethodgetGetter(java.lang.Class<?> domainType, java.lang.String property)Determine the method to invoke when retrieving the given property.java.lang.Class<?>getIdType(java.lang.Class<?> domainType)Returns the type of object the domain type'sfindFoo()orLocator.getId()expects to receive.java.lang.reflect.TypegetRequestReturnType(java.lang.reflect.Method contextMethod)Compute the return type for a method declared in a RequestContext by analyzing the generic method declaration.java.lang.reflect.MethodgetSetter(java.lang.Class<?> domainType, java.lang.String property)Determine the method to invoke when setting the given property.booleanrequiresServiceLocator(java.lang.reflect.Method contextMethod, java.lang.reflect.Method domainMethod)Determines if the invocation of a domain method requires aServiceLocatoras the 0th parameter when passed intoServiceLayer.invoke(Method, Object...).java.lang.Class<? extends BaseProxy>resolveClass(java.lang.String typeToken)Given a type token previously returned fromServiceLayer.resolveTypeToken(Class), return the Class literal associated with the token.<T> java.lang.Class<? extends T>resolveClientType(java.lang.Class<?> domainClass, java.lang.Class<T> clientType, boolean required)Determine the type used by the client code to represent a given domain type.java.lang.Class<?>resolveDomainClass(java.lang.Class<?> clazz)Determine the domain (server-side) type that the given client type is mapped to.java.lang.reflect.MethodresolveDomainMethod(java.lang.String operation)Return the domain service method associated with a RequestContext method declaration.java.lang.Class<? extends Locator<?,?>>resolveLocator(java.lang.Class<?> domainType)Return the type ofLocatorthat should be used to access the given domain type.java.lang.Class<? extends RequestContext>resolveRequestContext(java.lang.String operation)Find a RequestContext that should be used to fulfill the requested operation.java.lang.reflect.MethodresolveRequestContextMethod(java.lang.String operation)Find a RequestContext method declaration by name.java.lang.Class<? extends RequestFactory>resolveRequestFactory(java.lang.String binaryName)Loads and validates a RequestFactory interface.java.lang.Class<?>resolveServiceClass(java.lang.Class<? extends RequestContext> requestContextClass)Given aRequestContextmethod, find the service class referenced in theServiceorServiceNameannotation.java.lang.Class<? extends ServiceLocator>resolveServiceLocator(java.lang.Class<? extends RequestContext> requestContext)Given a RequestContext method declaration, resolve theServiceLocatorthat should be used when invoking the domain method.java.lang.StringresolveTypeToken(java.lang.Class<? extends BaseProxy> domainClass)Return a string used to represent the given type in the wire protocol.- 
Methods inherited from class com.google.web.bindery.requestfactory.server.ServiceLayerDecoratorcreateDomainObject, createServiceLocator, die, getId, getNext, getProperty, getTop, getVersion, invoke, isLive, loadDomainObject, loadDomainObjects, report, report, setProperty, validate
 - 
Methods inherited from class com.google.web.bindery.requestfactory.server.ServiceLayercreate
 
- 
 
- 
- 
- 
Method Detail- 
createLocatorpublic <T extends Locator<?,?>> T createLocator(java.lang.Class<T> clazz) Description copied from class:ServiceLayerCreate an instance of the requestedLocatortype.- Overrides:
- createLocatorin class- ServiceLayerDecorator
- Type Parameters:
- T- the requested Locator type
- Parameters:
- clazz- the requested Locator type
- Returns:
- an instance of the requested Locator type
 
 - 
createServiceInstancepublic java.lang.Object createServiceInstance(java.lang.Class<? extends RequestContext> requestContext) Description copied from class:ServiceLayerCreate an instance of a service object that can be used as the target for the given method invocation.- Overrides:
- createServiceInstancein class- ServiceLayerDecorator
- Parameters:
- requestContext- the RequestContext type for which a service object must be instantiated.
- Returns:
- an instance of the requested service object
 
 - 
getDomainClassLoaderpublic java.lang.ClassLoader getDomainClassLoader() Description copied from class:ServiceLayerReturns the ClassLoader that should be used when attempting to access domain classes or resources.The default implementation returns Thread.currentThread().getContextClassLoader().- Overrides:
- getDomainClassLoaderin class- ServiceLayerDecorator
 
 - 
getGetterpublic java.lang.reflect.Method getGetter(java.lang.Class<?> domainType, java.lang.String property)Description copied from class:ServiceLayerDetermine the method to invoke when retrieving the given property.- Overrides:
- getGetterin class- ServiceLayerDecorator
- Parameters:
- domainType- a domain entity type
- property- the name of the property to be retrieved
- Returns:
- the Method that should be invoked to retrieve the property or
         nullif the method could not be located
 
 - 
getIdTypepublic java.lang.Class<?> getIdType(java.lang.Class<?> domainType) Description copied from class:ServiceLayerReturns the type of object the domain type'sfindFoo()orLocator.getId()expects to receive.- Overrides:
- getIdTypein class- ServiceLayerDecorator
- Parameters:
- domainType- a domain entity type
- Returns:
- the type of the persistent id value used to represent the domain type
 
 - 
getRequestReturnTypepublic java.lang.reflect.Type getRequestReturnType(java.lang.reflect.Method contextMethod) Description copied from class:ServiceLayerCompute the return type for a method declared in a RequestContext by analyzing the generic method declaration.- Overrides:
- getRequestReturnTypein class- ServiceLayerDecorator
 
 - 
getSetterpublic java.lang.reflect.Method getSetter(java.lang.Class<?> domainType, java.lang.String property)Description copied from class:ServiceLayerDetermine the method to invoke when setting the given property.- Overrides:
- getSetterin class- ServiceLayerDecorator
- Parameters:
- domainType- a domain entity type
- property- the name of the property to be set
- Returns:
- the Method that should be invoked to set the property or
         nullif the method could not be located
 
 - 
requiresServiceLocatorpublic boolean requiresServiceLocator(java.lang.reflect.Method contextMethod, java.lang.reflect.Method domainMethod)Description copied from class:ServiceLayerDetermines if the invocation of a domain method requires aServiceLocatoras the 0th parameter when passed intoServiceLayer.invoke(Method, Object...).- Overrides:
- requiresServiceLocatorin class- ServiceLayerDecorator
- Parameters:
- contextMethod- a method defined in a RequestContext
- domainMethod- a domain method
- Returns:
- trueif a ServiceLocator is required
 
 - 
resolveClasspublic java.lang.Class<? extends BaseProxy> resolveClass(java.lang.String typeToken) Description copied from class:ServiceLayerGiven a type token previously returned fromServiceLayer.resolveTypeToken(Class), return the Class literal associated with the token.- Overrides:
- resolveClassin class- ServiceLayerDecorator
- Parameters:
- typeToken- a string token
- Returns:
- the type represented by the token
 
 - 
resolveClientTypepublic <T> java.lang.Class<? extends T> resolveClientType(java.lang.Class<?> domainClass, java.lang.Class<T> clientType, boolean required)Description copied from class:ServiceLayerDetermine the type used by the client code to represent a given domain type. If multiple proxy types have been mapped to the same domain type, theclientTypeparameter is used to ensure assignability.- Overrides:
- resolveClientTypein class- ServiceLayerDecorator
- Parameters:
- domainClass- the server-side type to be transported to the client
- clientType- the type to which the returned type must be assignable
- required- if- trueand no mapping is available, throw an exception, otherwise the method will return- null
- Returns:
- a class that represents domainClasson the client which is assignable toclientType
 
 - 
resolveDomainClasspublic java.lang.Class<?> resolveDomainClass(java.lang.Class<?> clazz) Description copied from class:ServiceLayerDetermine the domain (server-side) type that the given client type is mapped to.- Overrides:
- resolveDomainClassin class- ServiceLayerDecorator
- Parameters:
- clazz- a client-side type
- Returns:
- the domain type that clientTyperepresents
 
 - 
resolveDomainMethodpublic java.lang.reflect.Method resolveDomainMethod(java.lang.String operation) Description copied from class:ServiceLayerReturn the domain service method associated with a RequestContext method declaration. TherequestContextMethodwill have been previously resolved by#resolveRequestContextMethod(String, String).- Overrides:
- resolveDomainMethodin class- ServiceLayerDecorator
- Returns:
- the domain service method that should be invoked
 
 - 
resolveLocatorpublic java.lang.Class<? extends Locator<?,?>> resolveLocator(java.lang.Class<?> domainType) Description copied from class:ServiceLayerReturn the type ofLocatorthat should be used to access the given domain type.- Overrides:
- resolveLocatorin class- ServiceLayerDecorator
- Parameters:
- domainType- a domain (server-side) type
- Returns:
- the type of Locator to use, or nullif the type conforms to the RequestFactory entity protocol
 
 - 
resolveRequestContextpublic java.lang.Class<? extends RequestContext> resolveRequestContext(java.lang.String operation) Description copied from class:ServiceLayerFind a RequestContext that should be used to fulfill the requested operation.- Overrides:
- resolveRequestContextin class- ServiceLayerDecorator
- Parameters:
- operation- the operation
- Returns:
- the RequestContext or nullif no RequestContext exists that can fulfill the operation
 
 - 
resolveRequestContextMethodpublic java.lang.reflect.Method resolveRequestContextMethod(java.lang.String operation) Description copied from class:ServiceLayerFind a RequestContext method declaration by name.- Overrides:
- resolveRequestContextMethodin class- ServiceLayerDecorator
- Parameters:
- operation- the operation's name
- Returns:
- the method declaration, or nullif the method does not exist
 
 - 
resolveRequestFactorypublic java.lang.Class<? extends RequestFactory> resolveRequestFactory(java.lang.String binaryName) Description copied from class:ServiceLayerLoads and validates a RequestFactory interface.- Overrides:
- resolveRequestFactoryin class- ServiceLayerDecorator
- Parameters:
- binaryName- the RequestFactory's type token (usually the type's binary name)
- Returns:
- the RequestFactory type
 
 - 
resolveServiceClasspublic java.lang.Class<?> resolveServiceClass(java.lang.Class<? extends RequestContext> requestContextClass) Description copied from class:ServiceLayerGiven aRequestContextmethod, find the service class referenced in theServiceorServiceNameannotation.- Overrides:
- resolveServiceClassin class- ServiceLayerDecorator
- Parameters:
- requestContextClass- a RequestContext interface
- Returns:
- the type of service to use
 
 - 
resolveServiceLocatorpublic java.lang.Class<? extends ServiceLocator> resolveServiceLocator(java.lang.Class<? extends RequestContext> requestContext) Description copied from class:ServiceLayerGiven a RequestContext method declaration, resolve theServiceLocatorthat should be used when invoking the domain method. This method will only be called ifServiceLayer.requiresServiceLocator(Method, Method)returnedtruefor the associated domain method.- Overrides:
- resolveServiceLocatorin class- ServiceLayerDecorator
- Parameters:
- requestContext- the RequestContext for which a ServiceLocator must be located
- Returns:
- the type of ServiceLocator to use
 
 - 
resolveTypeTokenpublic java.lang.String resolveTypeToken(java.lang.Class<? extends BaseProxy> domainClass) Description copied from class:ServiceLayerReturn a string used to represent the given type in the wire protocol.- Overrides:
- resolveTypeTokenin class- ServiceLayerDecorator
- Parameters:
- domainClass- a client-side EntityProxy or ValueProxy type
- Returns:
- the type token used to represent the proxy type
 
 
- 
 
-