001    // Copyright 2005 The Apache Software Foundation
002    //
003    // Licensed under the Apache License, Version 2.0 (the "License");
004    // you may not use this file except in compliance with the License.
005    // You may obtain a copy of the License at
006    //
007    //     http://www.apache.org/licenses/LICENSE-2.0
008    //
009    // Unless required by applicable law or agreed to in writing, software
010    // distributed under the License is distributed on an "AS IS" BASIS,
011    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012    // See the License for the specific language governing permissions and
013    // limitations under the License.
014    
015    package org.apache.tapestry.annotations;
016    
017    import java.lang.annotation.Documented;
018    import java.lang.annotation.ElementType;
019    import java.lang.annotation.Retention;
020    import java.lang.annotation.RetentionPolicy;
021    import java.lang.annotation.Target;
022    
023    /**
024     * Used to define a parameter for the component.
025     * 
026     * @author Howard Lewis Ship
027     * @since 4.0
028     */
029    
030    @Target(
031    { ElementType.METHOD })
032    @Retention(RetentionPolicy.RUNTIME)
033    @Documented
034    public @interface Parameter {
035    
036        /**
037         * If true, then the parameter is required, and must be bound (there is no guarantee that a
038         * non-null value will be bound however, so the component may have to perform additonal checks).
039         * The default value, false, means the parameter is optional.
040         */
041    
042        boolean required() default false;
043    
044        /**
045         * The default value for the binding, as a binding reference.
046         */
047    
048        String defaultValue() default "";
049    
050        /**
051         * If true (the default), then the binding will cache its value while the component is
052         * renderering. In some cases, it is desirable to force the binding to be re-evaluated every
053         * time the parameter property is accessed, in which case cache should be set to false.
054         */
055    
056        boolean cache() default true;
057    
058        /**
059         * An optional list of alternate names for the parameter. The parameter may be bound using its
060         * true name or any alias (but not both!), but use of aliases will generate deprecation
061         * warnings.
062         */
063    
064        String aliases() default "";
065        
066        /**
067         * The name of the parameter.  If not specified, it will match the property name.  Note that this
068         * is backwards from the logic in the XML, where the parameter name is specified and the property name
069         * matches.
070         * 
071         */
072        
073        String name() default "";
074    }