Annotation Type AfterCompose

public @interface AfterCompose

Marker annotation to identify a life-cycle method in View Model. this method will be called after host component composition has been done (AfterCompose).
Only one method could be tagged with this annotation.

Inheritance: If you want binder to call super calss's afterCompose method also, you have to set superclass() to true, and super class's afterCompose method will be called first.
In the other hand, if target bean class doesn't has an afterCompose method but it's super has, you'll have to annotate AfterCompose on the bean type.

For example, in class hierarchy A(has @AfterCompose) <- B(has @AfterCompose, superclass true) <- C(no @AfterCompose) <- D (has @AfterCompose, superclass false). D is the last one.
If D is the view model, will call D.afterCompose only
If C is the view model, no method will be called
If B is the view model, will call A.afterCompose then B.afterCompose
If A is the view model, will call A.afterCompose

Exception: if superclass() was been set to true and your afterCompose method is an overridden method to it's super's afterCompose method, ex:
X.m1() <- Y.m1()
then Binder will throw an exception due to the conflict of java language's overriding nature.

Parameter Binding: for convenience, afterCompose method support several kinds of Parameter Annotations. Binder will weave it's context(Zul page annotation, Java EE Context) with method's parameters while invocation.
The difference between @AfterCompose and @Init is - afterCompose has no zul declaration's part by it's self. Instead, it will share BindingParam's with @init declaration in zul. An example of afterCompose method signature might be looks like this:
viewModel="@id('vm') @init('BlaBlaVM', a='b')"
@AfterCompose public void doAfterCompose(@BindingParam("a") String a)

Ian Y.T Tsai(zanyking)
See Also:
BindingParam, ExecutionParam, ExecutionArgParam, HeaderParam, CookieParam, QueryParam, ScopeParam, ContextParam, Default, Init

Optional Element Summary
 boolean superclass


public abstract boolean superclass

Copyright © 2005-2011 Potix Corporation. All Rights Reserved. Logo