Clover coverage report - Code Coverage for tapestry release 4.0-beta-12
Coverage timestamp: Sun Oct 30 2005 16:22:01 EST
file stats: LOC: 208   Methods: 18
NCLOC: 96   Classes: 1
 
 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 boolean _cache = true;
 52   
 53    /** @since 4.0 */
 54    private Collection _aliasNames = Collections.EMPTY_LIST;
 55   
 56    /** @since 4.0 */
 57    private String _parameterName;
 58   
 59    /** @since 4.0 */
 60    private boolean _deprecated = false;
 61   
 62    /**
 63    * Returns the class name of the expected type of the parameter. The default value is
 64    * <code>java.lang.Object</code> which matches anything.
 65    */
 66   
 67  1074 public String getType()
 68    {
 69  1074 return _type;
 70    }
 71   
 72    /**
 73    * Returns true if the parameter is required by the component. The default is false, meaning the
 74    * parameter is optional.
 75    */
 76   
 77  3618 public boolean isRequired()
 78    {
 79  3618 return _required;
 80    }
 81   
 82  1085 public void setRequired(boolean value)
 83    {
 84  1085 _required = value;
 85    }
 86   
 87    /**
 88    * Sets the type of value expected for the parameter. This can be left blank to indicate any
 89    * type.
 90    */
 91   
 92  42 public void setType(String value)
 93    {
 94  42 _type = value;
 95    }
 96   
 97    /**
 98    * Returns the documentation for this parameter.
 99    *
 100    * @since 1.0.9
 101    */
 102   
 103  1 public String getDescription()
 104    {
 105  1 return _description;
 106    }
 107   
 108    /**
 109    * Sets the documentation for this parameter.
 110    *
 111    * @since 1.0.9
 112    */
 113   
 114  771 public void setDescription(String description)
 115    {
 116  771 _description = description;
 117    }
 118   
 119    /**
 120    * Sets the property name (of the component class) to connect the parameter to.
 121    */
 122   
 123  1086 public void setPropertyName(String propertyName)
 124    {
 125  1086 _propertyName = propertyName;
 126    }
 127   
 128    /**
 129    * Returns the name of the JavaBeans property to connect the parameter to.
 130    */
 131   
 132  2166 public String getPropertyName()
 133    {
 134  2166 return _propertyName;
 135    }
 136   
 137    /**
 138    * @see org.apache.tapestry.spec.IParameterSpecification#getDefaultValue()
 139    */
 140  3131 public String getDefaultValue()
 141    {
 142  3131 return _defaultValue;
 143    }
 144   
 145    /**
 146    * @see org.apache.tapestry.spec.IParameterSpecification#setDefaultValue(java.lang.String)
 147    */
 148  1082 public void setDefaultValue(String defaultValue)
 149    {
 150  1082 _defaultValue = defaultValue;
 151    }
 152   
 153    /** @since 4.0 */
 154  1076 public boolean getCache()
 155    {
 156  1076 return _cache;
 157    }
 158   
 159    /** @since 4.0 */
 160  1082 public void setCache(boolean cache)
 161    {
 162  1082 _cache = cache;
 163    }
 164   
 165    /** @since 4.0 */
 166  1093 public Collection getAliasNames()
 167    {
 168  1093 return _aliasNames;
 169    }
 170   
 171    /** @since 4.0 */
 172  7318 public String getParameterName()
 173    {
 174  7318 return _parameterName;
 175    }
 176   
 177    /** @since 4.0 */
 178  1087 public void setAliases(String nameList)
 179    {
 180  1087 if (HiveMind.isNonBlank(nameList))
 181    {
 182  6 String[] names = TapestryUtils.split(nameList);
 183   
 184  6 _aliasNames = Arrays.asList(names);
 185    }
 186    }
 187   
 188    /** @since 4.0 */
 189  1096 public void setParameterName(String name)
 190    {
 191  1096 Defense.notNull(name, "name");
 192   
 193  1096 _parameterName = name;
 194    }
 195   
 196    /** @since 4.0 */
 197  418 public boolean isDeprecated()
 198    {
 199  418 return _deprecated;
 200    }
 201   
 202    /** @since 4.0 */
 203  1083 public void setDeprecated(boolean deprecated)
 204    {
 205  1083 _deprecated = deprecated;
 206    }
 207   
 208    }