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
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.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 returnnullto indicate that the domain object has not been persisted.Invoke a domain service method.booleanThis implementation attempts to re-load the object from the backing store.<T> TloadDomainObject(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.voidsetProperty(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, resolveTypeTokenMethods inherited from class com.google.web.bindery.requestfactory.server.ServiceLayer
create
-
Constructor Details
-
ReflectiveServiceLayer
ReflectiveServiceLayer()
-
-
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
-
getGetter
Description copied from class:ServiceLayerDetermine the method to invoke when retrieving the given property.- Overrides:
getGetterin 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
nullif the method could not be located
-
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
-
getProperty
Description copied from class:ServiceLayerRetrieve the named property from the domain object.- Overrides:
getPropertyin classServiceLayerDecorator- Parameters:
domainObject- the domain object being examinedproperty- the property name- Returns:
- the value of the property
-
getRequestReturnType
Description copied from class:ServiceLayerCompute the return type for a method declared in a RequestContext by analyzing the generic method declaration.- Overrides:
getRequestReturnTypein classServiceLayerDecorator
-
getSetter
Description copied from class:ServiceLayerDetermine the method to invoke when setting the given property.- Overrides:
getSetterin 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
nullif the method could not be located
-
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
-
invoke
Description copied from class:ServiceLayerInvoke a domain service method. The underlying eventually callsMethod.invoke(Object, Object...).- Overrides:
invokein 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:
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 loadid- an id previously returned fromServiceLayer.getId(Object)- Returns:
- the requested object or
nullif it is irretrievable
-
loadDomainObjects
Description copied from class:ServiceLayerLoad 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:
loadDomainObjectsin 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
nullif the requested objects were irretrievable
-
setProperty
Description copied from class:ServiceLayerSets a property on a domain object.- Overrides:
setPropertyin 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:ServiceLayerInvoke a JSR 303 validator on the given domain object. If no validator is available, this method is a no-op.- Overrides:
validatein 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
-