org.apache.tapestry5.annotations
Annotation Type Parameter


@Target(value=FIELD)
@Documented
@Retention(value=RUNTIME)
@UseWith(value={COMPONENT,MIXIN})
public @interface Parameter

Annotation placed on a field to indicate that it is, in fact, a component parameter. Parameters may be optional or required. Required parameters must be bound.


Optional Element Summary
 boolean allowNull
          If false, and the parameter is bound, then the value for the parameter must not be null.
 boolean autoconnect
          Used to create a default binding, connecting the parameter to a property of the container whose property name matches the id of the component.
 boolean cache
          If true (the default), then the value for the parameter is cached while the component is, itself, rendering.
 String defaultPrefix
          The default binding prefix for the parameter, if no specific binding prefix is provided with the binding.
 String name
          The name of the parameter.
 boolean principal
          Used to mark a parameter as requiring earlier initialization than other parameters.
 boolean required
          If true, the parameter is required and and must be bound.
 String value
          The default value for the parameter if not bound (and not the empty string).
 

name

public abstract String name
The name of the parameter. If not specified, the name of the parameter is derived from the name of the field (after stripping off leading and trailing punctuation).

Default:
""

required

public abstract boolean required
If true, the parameter is required and and must be bound. If false (the default), then the parameter is optional.

Default:
false

allowNull

public abstract boolean allowNull
If false, and the parameter is bound, then the value for the parameter must not be null. The default is true, to allow nulls. This is different than required, in that the parameter may be bound, but bound to a null value.

Default:
true

cache

public abstract boolean cache
If true (the default), then the value for the parameter is cached while the component is, itself, rendering. Values from invariant bindings (such as literal strings) are always cached, regardless of this setting. Set this attribute to false to force the parameter to be re-read every time the field is accessed, even while the component is rendering.

Default:
true

value

public abstract String value
The default value for the parameter if not bound (and not the empty string). This is a binding expression, typically the name of a property of the component to bind.

Default:
""

defaultPrefix

public abstract String defaultPrefix
The default binding prefix for the parameter, if no specific binding prefix is provided with the binding. There is rarely a reason to override this. Typically, non-standard default binding prefixes are paired with specific BindingFactory implementations, and used with parameters whose name reflects the binding prefix.

See Also:
BindingConstants
Default:
"prop"

principal

public abstract boolean principal
Used to mark a parameter as requiring earlier initialization than other parameters. This is used when default bindings for secondary parameters rely on a principal parameter, which itself may have a default value. This ensures that the binding for the principal parameter(s) are initialized, possibly involving a defaulter method, before the secondary parameters are initialized (as they may need to know if the principal parameter is bound, and what type of value it is bound to). This is rarely used, and it is highly unlikely a single component would have more than a single principal parameter.

Default:
false

autoconnect

public abstract boolean autoconnect
Used to create a default binding, connecting the parameter to a property of the container whose property name matches the id of the component. This is frequently used for form element components. This default binding is only used if there is no matching container property.

See Also:
ComponentDefaultProvider.defaultBinding(String, org.apache.tapestry5.ComponentResources)
Default:
false


Copyright © 2003-2012 The Apache Software Foundation.