001    // Copyright 2004, 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.spec;
016    
017    import java.util.Collection;
018    
019    import org.apache.hivemind.LocationHolder;
020    
021    /**
022     * Defines a formal parameter to a component. An
023     * <code>IParameterSpecification</code> is contained by a
024     * {@link IComponentSpecification}.
025     * <p>
026     * TBD: Identify arrays in some way.
027     * 
028     * @author glongman@intelligentworks.com
029     */
030    public interface IParameterSpecification extends LocationHolder
031    {
032    
033        /**
034         * Returns the class name of the expected type of the parameter. The default
035         * value is <code>java.lang.Object</code> which matches anything.
036         */
037        String getType();
038    
039        /**
040         * Returns true if the parameter is required by the component. The default
041         * is false, meaning the parameter is optional.
042         */
043        boolean isRequired();
044    
045        void setRequired(boolean value);
046    
047        /**
048         * Sets the type of value expected for the parameter. This can be left blank
049         * to indicate any type.
050         */
051        void setType(String value);
052    
053        /**
054         * Returns the documentation for this parameter.
055         * 
056         * @since 1.0.9
057         */
058        String getDescription();
059    
060        /**
061         * Sets the documentation for this parameter.
062         * 
063         * @since 1.0.9
064         */
065        void setDescription(String description);
066    
067        /**
068         * Sets the property name (of the component class) to connect the parameter
069         * to.
070         */
071        void setPropertyName(String propertyName);
072    
073        /**
074         * Returns the name of the JavaBeans property to connect the parameter to.
075         */
076        String getPropertyName();
077    
078        /**
079         * Returns the default value for the parameter (or null if the parameter has
080         * no default value). Required parameters may not have a default value. The
081         * default value is a <em>binding locator</em> (a prefixed value, as with
082         * a binding element).
083         */
084        String getDefaultValue();
085    
086        /**
087         * Sets the default value of the JavaBeans property if no binding is
088         * provided.
089         */
090        void setDefaultValue(String defaultValue);
091    
092        /**
093         * Returns true if the parameter property should cache the result of the
094         * binding.
095         * 
096         * @since 4.0
097         */
098    
099        boolean getCache();
100    
101        /** @since 4.0 */
102    
103        void setCache(boolean cache);
104    
105        /**
106         * Returns the (primary) name of the parameter.
107         * 
108         * @since 4.0
109         */
110    
111        String getParameterName();
112    
113        /**
114         * @since 4.0
115         */
116    
117        void setParameterName(String name);
118    
119        /**
120         * Returns a non-null collection of strings for the aliases of the
121         * parameter. This is usually an empty list.
122         * 
123         * @since 4.0
124         */
125    
126        Collection getAliasNames();
127    
128        /**
129         * Sets the list of aliases as a comma-seperated list.
130         * 
131         * @param nameList
132         *            a comma seperated list of names, which may be null or empty
133         * @since 4.0
134         */
135    
136        void setAliases(String nameList);
137    
138        /**
139         * Returns true if the parameter is deprecated. Deprecated parameter
140         * generate a warning when bound.
141         * 
142         * @since 4.0
143         */
144    
145        boolean isDeprecated();
146    
147        /**
148         * @since 4.0
149         */
150    
151        void setDeprecated(boolean deprecated);
152    
153    }