Class ReflectiveServiceLayer
java.lang.Object
com.google.web.bindery.requestfactory.server.ServiceLayer
com.google.web.bindery.requestfactory.server.ServiceLayerDecorator
com.google.web.bindery.requestfactory.server.ReflectiveServiceLayer
Implements all methods that interact with domain objects.
-
Field Summary
Fields inherited from class com.google.web.bindery.requestfactory.server.ServiceLayerDecorator
next
Fields inherited from class com.google.web.bindery.requestfactory.server.ServiceLayer
top
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T> T
createDomainObject
(Class<T> clazz) Create an instance of the requested domain type.Determine the method to invoke when retrieving the given property.Return the persistent id for a domain object.Class<?>
Returns the type of object the domain type'sfindFoo()
orLocator.getId()
expects to receive.getProperty
(Object domainObject, String property) Retrieve the named property from the domain object.getRequestReturnType
(Method contextMethod) Compute the return type for a method declared in a RequestContext by analyzing the generic method declaration.Determine the method to invoke when setting the given property.getVersion
(Object domainObject) May returnnull
to indicate that the domain object has not been persisted.Invoke a domain service method.boolean
This implementation attempts to re-load the object from the backing store.<T> T
loadDomainObject
(Class<T> clazz, Object id) Load an object from the backing store.loadDomainObjects
(List<Class<?>> classes, List<Object> domainIds) Load multiple objects from the backing store.void
setProperty
(Object domainObject, String property, Class<?> expectedType, Object value) Sets a property on a domain object.<T> Set<ConstraintViolation<T>>
validate
(T domainObject) Invoke a JSR 303 validator on the given domain object.Methods inherited from class com.google.web.bindery.requestfactory.server.ServiceLayerDecorator
createLocator, createServiceInstance, createServiceLocator, die, getDomainClassLoader, getNext, getTop, report, report, requiresServiceLocator, resolveClass, resolveClientType, resolveDomainClass, resolveDomainMethod, resolveLocator, resolveRequestContext, resolveRequestContextMethod, resolveRequestFactory, resolveServiceClass, resolveServiceLocator, resolveTypeToken
Methods inherited from class com.google.web.bindery.requestfactory.server.ServiceLayer
create
-
Constructor Details
-
ReflectiveServiceLayer
ReflectiveServiceLayer()
-
-
Method Details
-
createDomainObject
Description copied from class:ServiceLayer
Create an instance of the requested domain type.- Overrides:
createDomainObject
in classServiceLayerDecorator
- Type Parameters:
T
- the requested domain type- Parameters:
clazz
- the requested domain type- Returns:
- an instance of the requested domain type
-
getGetter
Description copied from class:ServiceLayer
Determine the method to invoke when retrieving the given property.- Overrides:
getGetter
in classServiceLayerDecorator
- Parameters:
domainType
- a domain entity typeproperty
- the name of the property to be retrieved- Returns:
- the Method that should be invoked to retrieve the property or
null
if the method could not be located
-
getId
Description copied from class:ServiceLayer
Return the persistent id for a domain object. May returnnull
to 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:
getId
in classServiceLayerDecorator
- Parameters:
domainObject
- a domain object- Returns:
- the persistent id of the domain object or
null
if the object is not persistent
-
getIdType
Description copied from class:ServiceLayer
Returns the type of object the domain type'sfindFoo()
orLocator.getId()
expects to receive.- Overrides:
getIdType
in classServiceLayerDecorator
- Parameters:
domainType
- a domain entity type- Returns:
- the type of the persistent id value used to represent the domain type
-
getProperty
Description copied from class:ServiceLayer
Retrieve the named property from the domain object.- Overrides:
getProperty
in classServiceLayerDecorator
- Parameters:
domainObject
- the domain object being examinedproperty
- the property name- Returns:
- the value of the property
-
getRequestReturnType
Description copied from class:ServiceLayer
Compute the return type for a method declared in a RequestContext by analyzing the generic method declaration.- Overrides:
getRequestReturnType
in classServiceLayerDecorator
-
getSetter
Description copied from class:ServiceLayer
Determine the method to invoke when setting the given property.- Overrides:
getSetter
in classServiceLayerDecorator
- Parameters:
domainType
- a domain entity typeproperty
- the name of the property to be set- Returns:
- the Method that should be invoked to set the property or
null
if the method could not be located
-
getVersion
Description copied from class:ServiceLayer
May returnnull
to 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:
getVersion
in classServiceLayerDecorator
- Parameters:
domainObject
- a domain object- Returns:
- the version of the domain object or
null
if the object is not persistent
-
invoke
Description copied from class:ServiceLayer
Invoke a domain service method. The underlying eventually callsMethod.invoke(Object, Object...)
.- Overrides:
invoke
in classServiceLayerDecorator
- Parameters:
domainMethod
- the method to invokeargs
- the arguments to pass to the method- Returns:
- the value returned from the method invocation
-
isLive
This implementation attempts to re-load the object from the backing store.- Overrides:
isLive
in classServiceLayerDecorator
- Parameters:
domainObject
- a domain entity- Returns:
true
ifdomainObject
could be retrieved at a later point in time
-
loadDomainObject
Description copied from class:ServiceLayer
Load an object from the backing store. This method may returnnull
to indicate that the requested object is no longer available.- Overrides:
loadDomainObject
in classServiceLayerDecorator
- Type Parameters:
T
- the type of object to load- Parameters:
clazz
- the type of object to loadid
- an id previously returned fromServiceLayer.getId(Object)
- Returns:
- the requested object or
null
if it is irretrievable
-
loadDomainObjects
Description copied from class:ServiceLayer
Load multiple objects from the backing store. This method is intended to allow more efficient access to the backing store by providing all objects referenced in an incoming payload.The default implementation of this method will delegate to
ServiceLayer.loadDomainObject(Class, Object)
.- Overrides:
loadDomainObjects
in classServiceLayerDecorator
- Parameters:
classes
- type type of each object to loaddomainIds
- the ids previously returned fromServiceLayer.getId(Object)
- Returns:
- the requested objects, elements of which may be
null
if the requested objects were irretrievable
-
setProperty
Description copied from class:ServiceLayer
Sets a property on a domain object.- Overrides:
setProperty
in classServiceLayerDecorator
- Parameters:
domainObject
- the domain object to operate onproperty
- the name of the property to setexpectedType
- the type of the propertyvalue
- the new value
-
validate
Description copied from class:ServiceLayer
Invoke a JSR 303 validator on the given domain object. If no validator is available, this method is a no-op.- Overrides:
validate
in classServiceLayerDecorator
- Type Parameters:
T
- the type of data being validated- Parameters:
domainObject
- the domain objcet to validate- Returns:
- the violations associated with the domain object
-