final class LocatorServiceLayer extends ServiceLayerDecorator
Locator
and
ServiceLocator
helper objects.next
top
Constructor and Description |
---|
LocatorServiceLayer() |
Modifier and Type | Method and Description |
---|---|
<T> T |
createDomainObject(java.lang.Class<T> clazz)
Create an instance of the requested domain type.
|
<T extends Locator<?,?>> |
createLocator(java.lang.Class<T> clazz)
Create an instance of the requested
Locator type. |
java.lang.Object |
createServiceInstance(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.
|
<T extends ServiceLocator> |
createServiceLocator(java.lang.Class<T> serviceLocatorType)
Create an instance of the requested
ServiceLocator type. |
java.lang.Object |
getId(java.lang.Object domainObject)
Return the persistent id for a domain object.
|
java.lang.Class<?> |
getIdType(java.lang.Class<?> domainType)
Returns the type of object the domain type's
findFoo() or
Locator.getId() expects to receive. |
java.lang.Object |
getVersion(java.lang.Object domainObject)
May return
null to indicate that the domain object has not been
persisted. |
boolean |
isLive(java.lang.Object domainObject)
Returns
true if the given domain object is still live (i.e. |
<T> T |
loadDomainObject(java.lang.Class<T> clazz,
java.lang.Object domainId)
Load an object from the backing store.
|
boolean |
requiresServiceLocator(java.lang.reflect.Method contextMethod,
java.lang.reflect.Method domainMethod)
Returns true if the context method returns a
Request and the domain
method is non-static. |
java.lang.Class<? extends Locator<?,?>> |
resolveLocator(java.lang.Class<?> domainType)
Return the type of
Locator that should be used to access the given
domain type. |
java.lang.Class<? extends ServiceLocator> |
resolveServiceLocator(java.lang.Class<? extends RequestContext> requestContext)
Given a RequestContext method declaration, resolve the
ServiceLocator that should be used when invoking the domain method. |
die, getDomainClassLoader, getGetter, getNext, getProperty, getRequestReturnType, getSetter, getTop, invoke, loadDomainObjects, report, report, resolveClass, resolveClientType, resolveDomainClass, resolveDomainMethod, resolveRequestContext, resolveRequestContextMethod, resolveRequestFactory, resolveServiceClass, resolveTypeToken, setProperty, validate
create
public <T> T createDomainObject(java.lang.Class<T> clazz)
ServiceLayer
createDomainObject
in class ServiceLayerDecorator
T
- the requested domain typeclazz
- the requested domain typepublic <T extends Locator<?,?>> T createLocator(java.lang.Class<T> clazz)
ServiceLayer
Locator
type.createLocator
in class ServiceLayerDecorator
T
- the requested Locator typeclazz
- the requested Locator typepublic java.lang.Object createServiceInstance(java.lang.Class<? extends RequestContext> requestContext)
ServiceLayer
createServiceInstance
in class ServiceLayerDecorator
requestContext
- the RequestContext type for which a service object
must be instantiated.public <T extends ServiceLocator> T createServiceLocator(java.lang.Class<T> serviceLocatorType)
ServiceLayer
ServiceLocator
type.createServiceLocator
in class ServiceLayerDecorator
T
- the requested ServiceLocator typeserviceLocatorType
- the requested ServiceLocator typepublic java.lang.Object getId(java.lang.Object domainObject)
ServiceLayer
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
ServiceLayer.loadDomainObject(Class, Object)
in the future.
getId
in class ServiceLayerDecorator
domainObject
- a domain objectnull
if the
object is not persistentpublic java.lang.Class<?> getIdType(java.lang.Class<?> domainType)
ServiceLayer
findFoo()
or
Locator.getId()
expects to receive.getIdType
in class ServiceLayerDecorator
domainType
- a domain entity typepublic java.lang.Object getVersion(java.lang.Object domainObject)
ServiceLayer
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.getVersion
in class ServiceLayerDecorator
domainObject
- a domain objectnull
if the object is
not persistentpublic boolean isLive(java.lang.Object domainObject)
ServiceLayer
true
if the given domain object is still live (i.e. not
deleted) in the backing store.isLive
in class ServiceLayerDecorator
domainObject
- a domain entitytrue
if domainObject
could be retrieved at a later
point in timepublic <T> T loadDomainObject(java.lang.Class<T> clazz, java.lang.Object domainId)
ServiceLayer
null
to indicate that the requested object is no longer available.loadDomainObject
in class ServiceLayerDecorator
T
- the type of object to loadclazz
- the type of object to loaddomainId
- an id previously returned from ServiceLayer.getId(Object)
null
if it is irretrievablepublic boolean requiresServiceLocator(java.lang.reflect.Method contextMethod, java.lang.reflect.Method domainMethod)
Request
and the domain
method is non-static.requiresServiceLocator
in class ServiceLayerDecorator
contextMethod
- a method defined in a RequestContextdomainMethod
- a domain methodtrue
if a ServiceLocator is requiredpublic java.lang.Class<? extends Locator<?,?>> resolveLocator(java.lang.Class<?> domainType)
ServiceLayer
Locator
that should be used to access the given
domain type.resolveLocator
in class ServiceLayerDecorator
domainType
- a domain (server-side) typenull
if the type conforms to
the RequestFactory entity protocolpublic java.lang.Class<? extends ServiceLocator> resolveServiceLocator(java.lang.Class<? extends RequestContext> requestContext)
ServiceLayer
ServiceLocator
that should be used when invoking the domain method.
This method will only be called if
ServiceLayer.requiresServiceLocator(Method, Method)
returned true
for
the associated domain method.resolveServiceLocator
in class ServiceLayerDecorator
requestContext
- the RequestContext for which a ServiceLocator must be
located