org.zkoss.bind.annotation
Annotation Type Init


@Target(value={METHOD,TYPE})
@Retention(value=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 set superclass() 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

Note that, if you override a method, which is both the init method of the the class and its super class. ex, X.m1() <- Y.m1()
Binder will throw a exception (or the Y.m1() will be called twice because of the java method overriding spec)

A initial method could also use with BindingParam and others to assign a argument as its parameter, and Default to assign a default value if the argument is null.

Since:
6.0.0
Author:
dennis
See Also:
BindingParam, ExecutionParam, ExecutionArgParam, HeaderParam, CookieParam, QueryParam, ScopeParam, ContextParam, Default

Optional Element Summary
 boolean superclass
           
 

superclass

public abstract boolean superclass
Default:
false


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