Clover coverage report - Code Coverage for tapestry release 4.0.1
Coverage timestamp: Fri Mar 31 2006 09:12:14 EST
file stats: LOC: 78   Methods: 4
NCLOC: 41   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
BasePropertyHolder.java 60% 64.7% 75% 64.5%
coverage 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.util;
 16   
 17    import java.util.ArrayList;
 18    import java.util.Collections;
 19    import java.util.HashMap;
 20    import java.util.List;
 21    import java.util.Map;
 22   
 23    /**
 24    * Base class implementation for the {@link IPropertyHolder} interface.
 25    *
 26    *
 27    * @author Howard Lewis Ship
 28    *
 29    **/
 30   
 31    public class BasePropertyHolder implements IPropertyHolder
 32    {
 33    private static final int MAP_SIZE = 7;
 34    private Map properties;
 35   
 36  7860 public String getProperty(String name)
 37    {
 38  7860 if (properties == null)
 39  6984 return null;
 40   
 41  876 return (String) properties.get(name);
 42    }
 43   
 44  116 public void setProperty(String name, String value)
 45    {
 46  116 if (value == null)
 47    {
 48  0 removeProperty(name);
 49  0 return;
 50    }
 51   
 52  116 if (properties == null)
 53  80 properties = new HashMap(MAP_SIZE);
 54   
 55  116 properties.put(name, value);
 56    }
 57   
 58  0 public void removeProperty(String name)
 59    {
 60  0 if (properties == null)
 61  0 return;
 62   
 63  0 properties.remove(name);
 64    }
 65   
 66  4 public List getPropertyNames()
 67    {
 68  4 if (properties == null)
 69  0 return Collections.EMPTY_LIST;
 70   
 71  4 List result = new ArrayList(properties.keySet());
 72   
 73  4 Collections.sort(result);
 74   
 75  4 return result;
 76    }
 77   
 78    }