org.apache.tapestry.annotations
Annotation Type Bean


@Target(value=METHOD)
@Retention(value=RUNTIME)
@Documented
public @interface Bean

Annotation used to define new managed beans, including limited/lightweight initialization. For complex initialiation, the XML specification is necessary.

One of the advantages is that, on the XML side, it is always necessary to provide complete class names; here on the Java/annotation side, we can leverage imports.

The managed bean will have a name that matches the property name; this allows such a bean to be referenced via the "bean:" binding prefix, or via IComponent.getBeans().

This annotation adds a new IBeanSpecification to the IComponentSpecification.

Since:
4.0
Author:
Howard M. Lewis Ship

Optional Element Summary
 String initializer
          Optional initializer string for the bean, as lightweight initialization (a list of properties and values).
 Lifecycle lifecycle
          The lifecycle of the bean, defaults to Lifecycle.REQUEST.
 Class value
          The Java class to instantiate.
 

value

public abstract Class value
The Java class to instantiate. The default is Object.class; if a non-default value is specified, that will be the class to instantiate; otherwise, the bean class will be determined from the property type. Generally, this annotation is only used when the property type is an interface (or abstract base class).

Default:
java.lang.Object.class

initializer

public abstract String initializer
Optional initializer string for the bean, as lightweight initialization (a list of properties and values).

Default:
""

lifecycle

public abstract Lifecycle lifecycle
The lifecycle of the bean, defaults to Lifecycle.REQUEST.

See Also:
BeanLifecycle
Default:
org.apache.tapestry.annotations.Lifecycle.REQUEST


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.