All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zkoss.bind.annotation.AfterCompose Maven / Gradle / Ivy

There is a newer version: 10.0.0-jakarta
Show newest version
/* AfterCompose.java

	Purpose:
		
	Description:
		
	History:
		Jun 20, 2012, Created by Ian YT Tsai(Zanyking)

Copyright (C) 2012 Potix Corporation. All Rights Reserved.

*/
package org.zkoss.bind.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 

* 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 * {@link #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 {@link 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 {@link #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)
* * * * @see BindingParam * @see ExecutionParam * @see ExecutionArgParam * @see HeaderParam * @see CookieParam * @see QueryParam * @see ScopeParam * @see ContextParam * @see Default * * @see Init * * @author Ian Y.T Tsai(zanyking) * @since 6.0.2 */ @Target({ ElementType.METHOD, ElementType.TYPE }) @Retention(RetentionPolicy.RUNTIME) public @interface AfterCompose { boolean superclass() default false; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy