java.lang.Object | ||
↳ | com.google.gwt.requestfactory.server.ServiceLayer | |
↳ | com.google.gwt.requestfactory.server.ServiceLayerDecorator |
Users that intend to alter how RequestFactory interacts with the domain
environment can extend this type and provide it to
create(ServiceLayerDecorator)
. The methods defined in
this type will automatically delegate to the next decorator or the root
service object after being processed bycreate()
.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create an instance of the requested domain type.
| |||||||||||
Create an instance of the requested
Locator type. | |||||||||||
Create an instance of a service object that can be used as the target for
the given method invocation.
| |||||||||||
Return the persistent id for a domain object.
| |||||||||||
Returns the type of object the domain type's
findFoo() or
Locator.getId() expects to receive. | |||||||||||
Retrieve the named property from the domain object.
| |||||||||||
Compute the return type for a method declared in a RequestContext by
analyzing the generic method declaration.
| |||||||||||
May return
null to indicate that the domain object has not been
persisted. | |||||||||||
Invoke a domain service method.
| |||||||||||
Returns
true if the given domain object is still live (i.e. | |||||||||||
Load an object from the backing store.
| |||||||||||
Load multiple objects from the backing store.
| |||||||||||
Determines if the invocation of a domain method requires a
ServiceLocator as the 0th parameter when passed into
#invoke(Method, Object...). | |||||||||||
Given a type token previously returned from
resolveTypeToken(Class) , return the Class literal associated with
the token. | |||||||||||
Determine the type used by the client code to represent a given domain
type.
| |||||||||||
Determine the domain (server-side) type that the given client type is
mapped to.
| |||||||||||
Return the domain service method associated with a RequestContext method
declaration.
| |||||||||||
Return the type of
Locator that should be used to access the given
domain type. | |||||||||||
Find a RequestContext method declaration by name.
| |||||||||||
Given a RequestContext method declaration, resolve the
ServiceLocator that should be used when invoking the domain method. | |||||||||||
Return a string used to represent the given type in the wire protocol.
| |||||||||||
Sets a property on a domain object.
| |||||||||||
Invoke a JSR 303 validator on the given domain object.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Throw a fatal error up into the top-level processing code.
| |||||||||||
Returns the top-most service layer.
| |||||||||||
Report an exception thrown by code that is under the control of the
end-developer.
| |||||||||||
Return a message to the client.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.google.gwt.requestfactory.server.ServiceLayer
| |||||||||||
From class
java.lang.Object
|
Create an instance of the requested domain type.
clazz | the requested domain type |
---|
Create an instance of the requested Locator
type.
clazz | the requested Locator type |
---|
Create an instance of a service object that can be used as the target for the given method invocation.
contextMethod | a method defined in a RequestContext |
---|---|
domainMethod | the method that the service object must implement |
Return the persistent id for a domain object. May return null
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
loadDomainObject(Class, Object)
in the future.
domainObject | a domain object |
---|
null
if the
object is not persistent
Returns the type of object the domain type's findFoo()
or
Locator.getId()
expects to receive.
domainType | a domain entity type |
---|
Retrieve the named property from the domain object.
domainObject | the domain object being examined |
---|---|
property | the property name |
Compute the return type for a method declared in a RequestContext by analyzing the generic method declaration.
May return null
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.
domainObject | a domain object |
---|
null
if the object is
not persistent
Invoke a domain service method. The underlying eventually calls Method#invoke(Object, Object...).
domainMethod | the method to invoke |
---|---|
args | the arguments to pass to the method |
Returns true
if the given domain object is still live (i.e. not
deleted) in the backing store.
domainObject | a domain entity |
---|
true
if domainObject
could be retrieved at a later
point in time
Load an object from the backing store. This method may return null
to indicate that the requested object is no longer available.
clazz | the type of object to load |
---|---|
domainId | an id previously returned from getId(Object) |
null
if it is irretrievable
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
loadDomainObject(Class, Object)
.
classes | type type of each object to load |
---|---|
domainIds | the ids previously returned from getId(Object) |
null
if the
requested objects were irretrievable
Determines if the invocation of a domain method requires a
ServiceLocator
as the 0th parameter when passed into
#invoke(Method, Object...).
contextMethod | a method defined in a RequestContext |
---|---|
domainMethod | a domain method |
true
if a ServiceLocator is required
Given a type token previously returned from
resolveTypeToken(Class)
, return the Class literal associated with
the token.
typeToken | a string token |
---|
Determine 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, the
clientType
parameter is used to ensure assignability.
domainClass | the server-side type to be transported to the client |
---|---|
clientType | the type to which the returned type must be assignable |
required | if true and no mapping is available, throw an
UnexpectedException, othrewise the method will return
null |
domainClass
on the client which is
assignable to clientType
Determine the domain (server-side) type that the given client type is mapped to.
clazz | a client-side type |
---|
clientType
represents
Return the domain service method associated with a RequestContext method
declaration. The requestContextMethod
will have been previously
resolved by resolveRequestContextMethod(String, String)
.
requestContextMethod | a RequestContext method declaration. |
---|
Return the type of Locator
that should be used to access the given
domain type.
domainType | a domain (server-side) type |
---|
null
if the type conforms to
the RequestFactory entity protocol
Find a RequestContext method declaration by name.
requestContextClass | the fully-qualified binary name of the RequestContext |
---|---|
methodName | the name of the service method declared within the RequestContext |
null
if the method does not
exist
Given a RequestContext method declaration, resolve the
ServiceLocator
that should be used when invoking the domain method.
This method will only be called if #requiresServiceLocator(Method)
returned true
for the associated domain method.
contextMethod | a RequestContext method declaration |
---|---|
domainMethod | the domain method that will be invoked |
Return a string used to represent the given type in the wire protocol.
proxyType | a client-side EntityProxy or ValueProxy type |
---|
Sets a property on a domain object.
domainObject | the domain object to operate on |
---|---|
property | the name of the property to set |
expectedType | the type of the property |
value | the new value |
Invoke a JSR 303 validator on the given domain object. If no validator is available, this method is a no-op.
domainObject | the domain objcet to validate |
---|
Throw a fatal error up into the top-level processing code. This method should be used to provide diagnostic information that will help the end-developer track down problems when that data would expose implementation details of the server to the client.
e | a throwable with more data, may be null |
---|---|
message | a printf-style format string |
args | arguments for the message |
this method never returns normally | |
UnexpectedException |
Returns the top-most service layer. General-purpose ServiceLayer decorators
should use the instance provided by getTop()
when calling public
methods on the ServiceLayer API to allow higher-level decorators to
override behaviors built into lower-level decorators.
create(ServiceLayerDecorator)
Report an exception thrown by code that is under the control of the end-developer.
this method never returns normally | |
ReportableException |
Return a message to the client. This method should not include any data that was not sent to the server by the client to avoid leaking data.
msg | a printf-style format string |
---|---|
args | arguments for the message |
this method never returns normally | |
ReportableException |