Since we have now mapped our aspect in WireBox, we now need to tell it the most important things:
- 1.To what classes or CFCs should we apply this aspect to?
- 2.To what methods or join points should we apply this aspect to?
We do this with another binder DSL method:
What is up with that funky
match().... stuff? Well, the classes and methods arguments of the
bindAspect()call uses our AOP funky matcher methods that exist in an object called:
wirebox.system.aop.Matcher. This matcher object is used to match classes and methods to whatever criteria you like. The binder has a convenience method called
match()that creates a new matcher object for you and returns it so you can configure it for classes and method matching. Here are the most common matching methods below:
WOW! We can really pin point anything in our system! So now that we have binded our aspect to our UserService I can rewrite it to this:
// do some work here
Now isn't that pretty? Much nicer and compact hugh! Plus I can reuse the method logger for ANY method in ANY class I desire (Muaaaahaaaa), that's an evil laugh by the way! But we are not done, let's keep going and do the Transactional aspect.