Hi all,
I really love bijection; it makes things so much easier. However, I have a requirement that makes it somehow hard to use contextual components.
Let's suppose we have a Checkout page, were you can enter shipping and a payment addresses. These addresses obviously belong to a model of the same type. Let us further assume, that entering an address triggers some logic (beyond validation) so we need a controller, say:
@Name("checkoutAddressController")
public class CheckoutAddressController {
// maybe a persistence manager
@In SomeService service
// our model
private Address address;
// [...]
// some logic, getter / setter etc
}@Name("checkoutPage")
public class CheckoutPage
{
@In(scope=ScopeType.STATELESS, create=true)
CheckoutAddressController c1;
@In(scope=ScopeType.STATELESS, create=true)
CheckoutAddressController c2;
// or even
List<CheckoutController> ctls;
@Create public void create() {
ctls = new ArrayList...
ctls.add(Component.getInstance("checkoutAddressController", ScopeType.STATELESS, true))
}
}Unless there is some complex creation logic, I think I'd just declare them in components.xml.