Class LocatorServiceLayer
java.lang.Object
com.google.web.bindery.requestfactory.server.ServiceLayer
com.google.web.bindery.requestfactory.server.ServiceLayerDecorator
com.google.web.bindery.requestfactory.server.LocatorServiceLayer
Adds support to the ServiceLayer chain for using
Locator and
ServiceLocator helper objects.-
Field Summary
Fields inherited from class com.google.web.bindery.requestfactory.server.ServiceLayerDecorator
nextFields inherited from class com.google.web.bindery.requestfactory.server.ServiceLayer
top -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> TcreateDomainObject(Class<T> clazz) Create an instance of the requested domain type.<T extends Locator<?,?>>
TcreateLocator(Class<T> clazz) Create an instance of the requestedLocatortype.createServiceInstance(Class<? extends RequestContext> requestContext) Create an instance of a service object that can be used as the target for the given method invocation.<T extends ServiceLocator>
TcreateServiceLocator(Class<T> serviceLocatorType) Create an instance of the requestedServiceLocatortype.Return the persistent id for a domain object.Class<?>Returns the type of object the domain type'sfindFoo()orLocator.getId()expects to receive.getVersion(Object domainObject) May returnnullto indicate that the domain object has not been persisted.booleanReturnstrueif the given domain object is still live (i.e.<T> TloadDomainObject(Class<T> clazz, Object domainId) Load an object from the backing store.booleanrequiresServiceLocator(Method contextMethod, Method domainMethod) Returns true if the context method returns aRequestand the domain method is non-static.resolveLocator(Class<?> domainType) Return the type ofLocatorthat should be used to access the given domain type.Class<? extends ServiceLocator>resolveServiceLocator(Class<? extends RequestContext> requestContext) Given a RequestContext method declaration, resolve theServiceLocatorthat should be used when invoking the domain method.Methods inherited from class com.google.web.bindery.requestfactory.server.ServiceLayerDecorator
die, getDomainClassLoader, getGetter, getNext, getProperty, getRequestReturnType, getSetter, getTop, invoke, loadDomainObjects, report, report, resolveClass, resolveClientType, resolveDomainClass, resolveDomainMethod, resolveRequestContext, resolveRequestContextMethod, resolveRequestFactory, resolveServiceClass, resolveTypeToken, setProperty, validateMethods inherited from class com.google.web.bindery.requestfactory.server.ServiceLayer
create
-
Constructor Details
-
LocatorServiceLayer
LocatorServiceLayer()
-
-
Method Details
-
createDomainObject
Description copied from class:ServiceLayerCreate an instance of the requested domain type.- Overrides:
createDomainObjectin classServiceLayerDecorator- Type Parameters:
T- the requested domain type- Parameters:
clazz- the requested domain type- Returns:
- an instance of the requested domain type
-
createLocator
Description copied from class:ServiceLayerCreate an instance of the requestedLocatortype.- Overrides:
createLocatorin classServiceLayerDecorator- Type Parameters:
T- the requested Locator type- Parameters:
clazz- the requested Locator type- Returns:
- an instance of the requested Locator type
-
createServiceInstance
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 classServiceLayerDecorator- Parameters:
requestContext- the RequestContext type for which a service object must be instantiated.- Returns:
- an instance of the requested service object
-
createServiceLocator
Description copied from class:ServiceLayerCreate an instance of the requestedServiceLocatortype.- Overrides:
createServiceLocatorin classServiceLayerDecorator- Type Parameters:
T- the requested ServiceLocator type- Parameters:
serviceLocatorType- the requested ServiceLocator type- Returns:
- an instance of the requested ServiceLocator type
-
getId
Description copied from class:ServiceLayerReturn the persistent id for a domain object. May returnnullto indicate that the domain object has not been persisted. The value returned from this method must be a simple type (e.g. Integer, String) or a domain type for which a mapping to an EntityProxy or Value proxy exists.The values returned from this method may be passed to
ServiceLayer.loadDomainObject(Class, Object)in the future.- Overrides:
getIdin classServiceLayerDecorator- Parameters:
domainObject- a domain object- Returns:
- the persistent id of the domain object or
nullif the object is not persistent
-
getIdType
Description copied from class:ServiceLayerReturns the type of object the domain type'sfindFoo()orLocator.getId()expects to receive.- Overrides:
getIdTypein classServiceLayerDecorator- Parameters:
domainType- a domain entity type- Returns:
- the type of the persistent id value used to represent the domain type
-
getVersion
Description copied from class:ServiceLayerMay returnnullto indicate that the domain object has not been persisted. The value returned from this method must be a simple type (e.g. Integer, String) or a domain type for which a mapping to an EntityProxy or Value proxy exists.- Overrides:
getVersionin classServiceLayerDecorator- Parameters:
domainObject- a domain object- Returns:
- the version of the domain object or
nullif the object is not persistent
-
isLive
Description copied from class:ServiceLayerReturnstrueif the given domain object is still live (i.e. not deleted) in the backing store.- Overrides:
isLivein classServiceLayerDecorator- Parameters:
domainObject- a domain entity- Returns:
trueifdomainObjectcould be retrieved at a later point in time
-
loadDomainObject
Description copied from class:ServiceLayerLoad an object from the backing store. This method may returnnullto indicate that the requested object is no longer available.- Overrides:
loadDomainObjectin classServiceLayerDecorator- Type Parameters:
T- the type of object to load- Parameters:
clazz- the type of object to loaddomainId- an id previously returned fromServiceLayer.getId(Object)- Returns:
- the requested object or
nullif it is irretrievable
-
requiresServiceLocator
Returns true if the context method returns aRequestand the domain method is non-static.- Overrides:
requiresServiceLocatorin classServiceLayerDecorator- Parameters:
contextMethod- a method defined in a RequestContextdomainMethod- a domain method- Returns:
trueif a ServiceLocator is required
-
resolveLocator
Description copied from class:ServiceLayerReturn the type ofLocatorthat should be used to access the given domain type.- Overrides:
resolveLocatorin classServiceLayerDecorator- Parameters:
domainType- a domain (server-side) type- Returns:
- the type of Locator to use, or
nullif the type conforms to the RequestFactory entity protocol
-
resolveServiceLocator
public Class<? extends ServiceLocator> resolveServiceLocator(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 classServiceLayerDecorator- Parameters:
requestContext- the RequestContext for which a ServiceLocator must be located- Returns:
- the type of ServiceLocator to use
-