Clover coverage report - Code Coverage for tapestry release 4.0-beta-2
Coverage timestamp: Sat Jul 9 2005 22:02:17 EDT
file stats: LOC: 223   Methods: 20
NCLOC: 105   Classes: 1
30 day Evaluation License registered to hlship@comcast.net Your 30 day evaluation period has expired. Please visit http://www.cenqua.com to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
ParameterSpecification.java 100% 100% 100% 100%
coverage
 1    // Copyright 2004, 2005 The Apache Software Foundation
 2    //
 3    // Licensed under the Apache License, Version 2.0 (the "License");
 4    // you may not use this file except in compliance with the License.
 5    // You may obtain a copy of the License at
 6    //
 7    // http://www.apache.org/licenses/LICENSE-2.0
 8    //
 9    // Unless required by applicable law or agreed to in writing, software
 10    // distributed under the License is distributed on an "AS IS" BASIS,
 11    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12    // See the License for the specific language governing permissions and
 13    // limitations under the License.
 14   
 15    package org.apache.tapestry.spec;
 16   
 17    import java.util.Arrays;
 18    import java.util.Collection;
 19    import java.util.Collections;
 20   
 21    import org.apache.hivemind.HiveMind;
 22    import org.apache.hivemind.impl.BaseLocatable;
 23    import org.apache.hivemind.util.Defense;
 24    import org.apache.tapestry.TapestryUtils;
 25   
 26    /**
 27    * Defines a formal parameter to a component. A <code>IParameterSpecification</code> is contained
 28    * by a {@link IComponentSpecification}.
 29    * <p>
 30    * TBD: Identify arrays in some way.
 31    *
 32    * @author Howard Lewis Ship
 33    */
 34   
 35    public class ParameterSpecification extends BaseLocatable implements IParameterSpecification
 36    {
 37    private boolean _required = false;
 38   
 39    private String _type;
 40   
 41    /** @since 1.0.9 */
 42    private String _description;
 43   
 44    /** @since 2.0.3 */
 45    private String _propertyName;
 46   
 47    /** @since 3.0 */
 48    private String _defaultValue;
 49   
 50    /** @since 4.0 */
 51    private String _defaultBindingType;
 52   
 53    /** @since 4.0 */
 54    private boolean _cache = true;
 55   
 56    /** @since 4.0 */
 57    private Collection _aliasNames = Collections.EMPTY_LIST;
 58   
 59    /** @since 4.0 */
 60    private String _parameterName;
 61   
 62    /** @since 4.0 */
 63    private boolean _deprecated = false;
 64   
 65    /**
 66    * Returns the class name of the expected type of the parameter. The default value is
 67    * <code>java.lang.Object</code> which matches anything.
 68    */
 69   
 70  1091 public String getType()
 71    {
 72  1091 return _type;
 73    }
 74   
 75    /**
 76    * Returns true if the parameter is required by the component. The default is false, meaning the
 77    * parameter is optional.
 78    */
 79   
 80  3865 public boolean isRequired()
 81    {
 82  3865 return _required;
 83    }
 84   
 85  1103 public void setRequired(boolean value)
 86    {
 87  1103 _required = value;
 88    }
 89   
 90    /**
 91    * Sets the type of value expected for the parameter. This can be left blank to indicate any
 92    * type.
 93    */
 94   
 95  41 public void setType(String value)
 96    {
 97  41 _type = value;
 98    }
 99   
 100    /**
 101    * Returns the documentation for this parameter.
 102    *
 103    * @since 1.0.9
 104    */
 105   
 106  1 public String getDescription()
 107    {
 108  1 return _description;
 109    }
 110   
 111    /**
 112    * Sets the documentation for this parameter.
 113    *
 114    * @since 1.0.9
 115    */
 116   
 117  759 public void setDescription(String description)
 118    {
 119  759 _description = description;
 120    }
 121   
 122    /**
 123    * Sets the property name (of the component class) to connect the parameter to.
 124    */
 125   
 126  1103 public void setPropertyName(String propertyName)
 127    {
 128  1103 _propertyName = propertyName;
 129    }
 130   
 131    /**
 132    * Returns the name of the JavaBeans property to connect the parameter to.
 133    */
 134   
 135  2200 public String getPropertyName()
 136    {
 137  2200 return _propertyName;
 138    }
 139   
 140    /**
 141    * @see org.apache.tapestry.spec.IParameterSpecification#getDefaultValue()
 142    */
 143  3367 public String getDefaultValue()
 144    {
 145  3367 return _defaultValue;
 146    }
 147   
 148    /**
 149    * @see org.apache.tapestry.spec.IParameterSpecification#setDefaultValue(java.lang.String)
 150    */
 151  1100 public void setDefaultValue(String defaultValue)
 152    {
 153  1100 _defaultValue = defaultValue;
 154    }
 155   
 156    /** @since 4.0 */
 157  1586 public String getDefaultBindingType()
 158    {
 159  1586 return _defaultBindingType;
 160    }
 161   
 162    /** @since 4.0 */
 163  1100 public void setDefaultBindingType(String defaultBindingType)
 164    {
 165  1100 _defaultBindingType = defaultBindingType;
 166    }
 167   
 168    /** @since 4.0 */
 169  1093 public boolean getCache()
 170    {
 171  1093 return _cache;
 172    }
 173   
 174    /** @since 4.0 */
 175  1100 public void setCache(boolean cache)
 176    {
 177  1100 _cache = cache;
 178    }
 179   
 180    /** @since 4.0 */
 181  1110 public Collection getAliasNames()
 182    {
 183  1110 return _aliasNames;
 184    }
 185   
 186    /** @since 4.0 */
 187  6684 public String getParameterName()
 188    {
 189  6684 return _parameterName;
 190    }
 191   
 192    /** @since 4.0 */
 193  1104 public void setAliases(String nameList)
 194    {
 195  1104 if (HiveMind.isNonBlank(nameList))
 196    {
 197  5 String[] names = TapestryUtils.split(nameList);
 198   
 199  5 _aliasNames = Arrays.asList(names);
 200    }
 201    }
 202   
 203    /** @since 4.0 */
 204  1109 public void setParameterName(String name)
 205    {
 206  1109 Defense.notNull(name, "name");
 207   
 208  1109 _parameterName = name;
 209    }
 210   
 211    /** @since 4.0 */
 212  489 public boolean isDeprecated()
 213    {
 214  489 return _deprecated;
 215    }
 216   
 217    /** @since 4.0 */
 218  1101 public void setDeprecated(boolean deprecated)
 219    {
 220  1101 _deprecated = deprecated;
 221    }
 222   
 223    }