Class ServiceLayerCache

    • Constructor Detail

      • ServiceLayerCache

        ServiceLayerCache()
    • Method Detail

      • createLocator

        public <T extends Locator<?,​?>> T createLocator​(java.lang.Class<T> clazz)
        Description copied from class: ServiceLayer
        Create an instance of the requested Locator type.
        Overrides:
        createLocator in class ServiceLayerDecorator
        Type Parameters:
        T - the requested Locator type
        Parameters:
        clazz - the requested Locator type
        Returns:
        an instance of the requested Locator type
      • createServiceInstance

        public java.lang.Object createServiceInstance​(java.lang.Class<? extends RequestContext> requestContext)
        Description copied from class: ServiceLayer
        Create an instance of a service object that can be used as the target for the given method invocation.
        Overrides:
        createServiceInstance in class ServiceLayerDecorator
        Parameters:
        requestContext - the RequestContext type for which a service object must be instantiated.
        Returns:
        an instance of the requested service object
      • getDomainClassLoader

        public java.lang.ClassLoader getDomainClassLoader()
        Description copied from class: ServiceLayer
        Returns the ClassLoader that should be used when attempting to access domain classes or resources.

        The default implementation returns Thread.currentThread().getContextClassLoader().

        Overrides:
        getDomainClassLoader in class ServiceLayerDecorator
      • getGetter

        public java.lang.reflect.Method getGetter​(java.lang.Class<?> domainType,
                                                  java.lang.String property)
        Description copied from class: ServiceLayer
        Determine the method to invoke when retrieving the given property.
        Overrides:
        getGetter in class ServiceLayerDecorator
        Parameters:
        domainType - a domain entity type
        property - 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
      • getIdType

        public java.lang.Class<?> getIdType​(java.lang.Class<?> domainType)
        Description copied from class: ServiceLayer
        Returns the type of object the domain type's findFoo() or Locator.getId() expects to receive.
        Overrides:
        getIdType in class ServiceLayerDecorator
        Parameters:
        domainType - a domain entity type
        Returns:
        the type of the persistent id value used to represent the domain type
      • getRequestReturnType

        public java.lang.reflect.Type getRequestReturnType​(java.lang.reflect.Method contextMethod)
        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 class ServiceLayerDecorator
      • getSetter

        public java.lang.reflect.Method getSetter​(java.lang.Class<?> domainType,
                                                  java.lang.String property)
        Description copied from class: ServiceLayer
        Determine the method to invoke when setting the given property.
        Overrides:
        getSetter in class ServiceLayerDecorator
        Parameters:
        domainType - a domain entity type
        property - 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
      • requiresServiceLocator

        public boolean requiresServiceLocator​(java.lang.reflect.Method contextMethod,
                                              java.lang.reflect.Method domainMethod)
        Description copied from class: ServiceLayer
        Determines if the invocation of a domain method requires a ServiceLocator as the 0th parameter when passed into ServiceLayer.invoke(Method, Object...).
        Overrides:
        requiresServiceLocator in class ServiceLayerDecorator
        Parameters:
        contextMethod - a method defined in a RequestContext
        domainMethod - a domain method
        Returns:
        true if a ServiceLocator is required
      • resolveClientType

        public <T> java.lang.Class<? extends T> resolveClientType​(java.lang.Class<?> domainClass,
                                                                  java.lang.Class<T> clientType,
                                                                  boolean required)
        Description copied from class: ServiceLayer
        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.
        Overrides:
        resolveClientType in class ServiceLayerDecorator
        Parameters:
        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 exception, otherwise the method will return null
        Returns:
        a class that represents domainClass on the client which is assignable to clientType
      • resolveDomainClass

        public java.lang.Class<?> resolveDomainClass​(java.lang.Class<?> clazz)
        Description copied from class: ServiceLayer
        Determine the domain (server-side) type that the given client type is mapped to.
        Overrides:
        resolveDomainClass in class ServiceLayerDecorator
        Parameters:
        clazz - a client-side type
        Returns:
        the domain type that clientType represents
      • resolveDomainMethod

        public java.lang.reflect.Method resolveDomainMethod​(java.lang.String operation)
        Description copied from class: ServiceLayer
        Return the domain service method associated with a RequestContext method declaration. The requestContextMethod will have been previously resolved by #resolveRequestContextMethod(String, String).
        Overrides:
        resolveDomainMethod in class ServiceLayerDecorator
        Returns:
        the domain service method that should be invoked
      • resolveLocator

        public java.lang.Class<? extends Locator<?,​?>> resolveLocator​(java.lang.Class<?> domainType)
        Description copied from class: ServiceLayer
        Return the type of Locator that should be used to access the given domain type.
        Overrides:
        resolveLocator in class ServiceLayerDecorator
        Parameters:
        domainType - a domain (server-side) type
        Returns:
        the type of Locator to use, or null if the type conforms to the RequestFactory entity protocol
      • resolveRequestContext

        public java.lang.Class<? extends RequestContext> resolveRequestContext​(java.lang.String operation)
        Description copied from class: ServiceLayer
        Find a RequestContext that should be used to fulfill the requested operation.
        Overrides:
        resolveRequestContext in class ServiceLayerDecorator
        Parameters:
        operation - the operation
        Returns:
        the RequestContext or null if no RequestContext exists that can fulfill the operation
      • resolveRequestContextMethod

        public java.lang.reflect.Method resolveRequestContextMethod​(java.lang.String operation)
        Description copied from class: ServiceLayer
        Find a RequestContext method declaration by name.
        Overrides:
        resolveRequestContextMethod in class ServiceLayerDecorator
        Parameters:
        operation - the operation's name
        Returns:
        the method declaration, or null if the method does not exist
      • resolveRequestFactory

        public java.lang.Class<? extends RequestFactory> resolveRequestFactory​(java.lang.String binaryName)
        Description copied from class: ServiceLayer
        Loads and validates a RequestFactory interface.
        Overrides:
        resolveRequestFactory in class ServiceLayerDecorator
        Parameters:
        binaryName - the RequestFactory's type token (usually the type's binary name)
        Returns:
        the RequestFactory type
      • resolveTypeToken

        public java.lang.String resolveTypeToken​(java.lang.Class<? extends BaseProxy> domainClass)
        Description copied from class: ServiceLayer
        Return a string used to represent the given type in the wire protocol.
        Overrides:
        resolveTypeToken in class ServiceLayerDecorator
        Parameters:
        domainClass - a client-side EntityProxy or ValueProxy type
        Returns:
        the type token used to represent the proxy type