Clover coverage report - Code Coverage for tapestry release 4.0.1
Coverage timestamp: Fri Mar 31 2006 09:12:14 EST
file stats: LOC: 125   Methods: 13
NCLOC: 70   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ServiceEncodingImpl.java - 95.2% 92.3% 94.1%
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.engine;
 16   
 17    import java.util.Map;
 18   
 19    import org.apache.hivemind.util.Defense;
 20    import org.apache.tapestry.util.QueryParameterMap;
 21   
 22    /**
 23    * Implementation of {@link org.apache.tapestry.engine.ServiceEncoding}, which adds the ability to
 24    * determine when the encoding has been modified.
 25    *
 26    * @author Howard M. Lewis Ship
 27    * @since 4.0
 28    */
 29    public class ServiceEncodingImpl implements ServiceEncoding
 30    {
 31    private String _servletPath;
 32   
 33    private String _pathInfo;
 34   
 35    /**
 36    * Map of query parameter values; key is string name, value is either a string, an array of
 37    * strings, or null. Could have done this with subclassing rather than delegation.
 38    */
 39   
 40    private final QueryParameterMap _parameters;
 41   
 42    private boolean _modified;
 43   
 44  22 public boolean isModified()
 45    {
 46  22 return _modified;
 47    }
 48   
 49  2 public void resetModified()
 50    {
 51  2 _modified = false;
 52    }
 53   
 54    /**
 55    * Creates a new instance with a new map of parameters.
 56    */
 57   
 58  10 public ServiceEncodingImpl(String servletPath)
 59    {
 60  10 this(servletPath, null, new QueryParameterMap());
 61    }
 62   
 63  382 public ServiceEncodingImpl(String servletPath, Map parametersMap)
 64    {
 65  382 this(servletPath, null, new QueryParameterMap(parametersMap));
 66    }
 67   
 68  638 public ServiceEncodingImpl(String servletPath, String pathInfo, QueryParameterMap parameters)
 69    {
 70  638 Defense.notNull(servletPath, "servletPath");
 71  638 Defense.notNull(parameters, "parameters");
 72   
 73  638 _servletPath = servletPath;
 74  638 _pathInfo = pathInfo;
 75   
 76  638 _parameters = parameters;
 77    }
 78   
 79  16 public String getParameterValue(String name)
 80    {
 81  16 return _parameters.getParameterValue(name);
 82    }
 83   
 84  4 public String[] getParameterValues(String name)
 85    {
 86  4 return _parameters.getParameterValues(name);
 87    }
 88   
 89  8 public void setServletPath(String servletPath)
 90    {
 91  8 Defense.notNull(servletPath, "servletPath");
 92   
 93  8 _servletPath = servletPath;
 94  8 _modified = true;
 95    }
 96   
 97  20 public void setParameterValue(String name, String value)
 98    {
 99  20 _parameters.setParameterValue(name, value);
 100   
 101  20 _modified = true;
 102    }
 103   
 104  4 public void setParameterValues(String name, String[] values)
 105    {
 106  4 _parameters.setParameterValues(name, values);
 107   
 108  4 _modified = true;
 109    }
 110   
 111  384 public String getServletPath()
 112    {
 113  384 return _servletPath;
 114    }
 115   
 116  2 public String[] getParameterNames()
 117    {
 118  2 return _parameters.getParameterNames();
 119    }
 120   
 121  0 public String getPathInfo()
 122    {
 123  0 return _pathInfo;
 124    }
 125    }