Everything Is Component
Yan is an ultra-flexible component-oriented object creation framework.
When you may be still wondering whether Yan supports "constructor injection", "setter injection" or even hopefully "method name injection", Yan goes far beyond that. See Dependency Injection Types for detailed discussion.
The class Component encapsulates the "how to create an object" logic. And it could be anything.
A very distinctive feature of Yan is:
Component is a self-consistent concept. Everything is a Component.
- Constructor injection is a Component.
- Setter injection is a Component.
- Magic method name is by no exception a Component.
- Any value is a Component.
- Need to customize a parameter for a constructor? use a Component. And the result is a new Component.
- Need to set a property for a bean? use a Component. And the result is a new Component.
- Need to use singleton pattern? apply the singleton() function to the Component. And the result is a new Component.
- Need to call a method on the instance of the Component? apply the method() function. And the result is a new Component.
- Need to create a list or array? apply list() (http://yan.codehaus.org/api/jfun/yan/Components.html#list(jfun.yan.Creator\[\])) or array() (http://yan.codehaus.org/api/jfun/yan/Components.html#array(jfun.yan.Component\[\]). And the result is a new Component.
- Need to transform the instance of Component A? apply the map(). And the result is a new Component.
- Need to dynamically determine a Component to use based on the result of Component A? apply bind(). And the result, not surprisingly, is a new Component too that can participate in yet another round of combination.
A lot more to be continued.
Hopefully you have seen by now, this is far more powerful than just constructor/setter/magic method name — they are only a few primitive Component's provided by Yan.
Since everything is a Component, only your imagination is the limit for what can be done by the combinations of these primitive Component's and their combinations and their combinations of combinations of combinations. Writing new Component becomes an evolution rather than a development.
Loads of code can be re-used because they are just Component's that you can combine with any other Component's freely.
Yan achieves all these using combinatory logic, a powerful design paradiam invented by the smart functional programming geeks.