Interface AdvisorDef

  • All Known Subinterfaces:
    AdvisorDef2
    All Known Implementing Classes:
    AdvisorDefImpl

    public interface AdvisorDef
    Definition of a service advisor, which (by default) is derived from a service advisor method. Service advisor methods are static or instance methods on module classes prefixed with "advise". When a service is realized, a list of matching AdvisorDefs is generated, then ordered, and from each a ServiceAdvisor is obtained and invoked. Note: service decorators (via DecoratorDef are applied around the interceptor generated via service advisors, (for compatibility with Tapestry 5.0). In general, you should use service decoration or service advice, not both.
    Since:
    5.1.0.0
    • Method Detail

      • getAdvisorId

        String getAdvisorId()
        Returns the id of the advisor, which is derived from the advisor method name.
      • getConstraints

        String[] getConstraints()
        Returns ordering constraints for this advisor, to order it relative to other advisors.
        Returns:
        zero or more constraint strings
      • createAdvisor

        ServiceAdvisor createAdvisor(ModuleBuilderSource moduleSource,
                                     ServiceResources resources)
        Creates an object that can provide the service advice (in the default case, by invoking the advise method on the module class or instance).
        Parameters:
        moduleSource - used to obtain the module instance
        resources - used to provide injections into the advise method
        Returns:
        advisor
      • matches

        boolean matches(ServiceDef serviceDef)
        Used to determine which services may be advised. When advising a service, first the advisors that target the service are identified, then ordering occurs, then the ServiceAdvisors are obtained and invoked.
        Parameters:
        serviceDef - identifies a service that may be advised
        Returns:
        true if this advisor applies to the service