Annotation Type Init
-
@Target({METHOD,TYPE}) @Retention(RUNTIME) public @interface Init
Marker annotation to identify a initial method.
Only one (could be zero) initial method is allowed in a particular class. If you want binder to call super calss's initial method also, you have to setsuperclass()
to true, and super class's initial method will be called first. You could annotate it on the type if the class doesn't has a init method but super-class has.For example, in class hierarchy A(has @Init) <- B(has @Init, superclass true) <- C(no @Init) <- D (has @Init, superclass false). D is the last one.
If D is the view model, will call D.init only
If C is the view model, no method will be called
If B is the view model, will call A.init then B.init
If A is the view model, will call A.init
Exception: if
superclass()
was been set to true and your initial method is an overridden method to it's super's initial method, ex:
X.m1() <- Y.m1()
Binder will throw an exception due to the conflict of java language's overriding nature.
Parameter Binding, for convenience, initial 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.
For example, you can wire @init('BlaBlaVM', a='b') to an initial method like:
@Init public void doInit(@BindingParam("a") String a)
- Since:
- 6.0.0
- Author:
- dennis
- See Also:
BindingParam
,ExecutionParam
,ExecutionArgParam
,HeaderParam
,CookieParam
,QueryParam
,ScopeParam
,ContextParam
,Default
,AfterCompose
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description boolean
superclass
-