Interface AdvisorDef

  • All Known Subinterfaces:
    All Known Implementing Classes:

    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.
    • Method Detail

      • getAdvisorId

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

        java.lang.String[] getConstraints()
        Returns ordering constraints for this advisor, to order it relative to other advisors.
        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).
        moduleSource - used to obtain the module instance
        resources - used to provide injections into the advise method
      • 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.
        serviceDef - identifies a service that may be advised
        true if this advisor applies to the service