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: 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  11 public boolean isModified()
 45    {
 46  11 return _modified;
 47    }
 48   
 49  1 public void resetModified()
 50    {
 51  1 _modified = false;
 52    }
 53   
 54    /**
 55    * Creates a new instance with a new map of parameters.
 56    */
 57   
 58  5 public ServiceEncodingImpl(String servletPath)
 59    {
 60  5 this(servletPath, null, new QueryParameterMap());
 61    }
 62   
 63  192 public ServiceEncodingImpl(String servletPath, Map parametersMap)
 64    {
 65  192 this(servletPath, null, new QueryParameterMap(parametersMap));
 66    }
 67   
 68  320 public ServiceEncodingImpl(String servletPath, String pathInfo, QueryParameterMap parameters)
 69    {
 70  320 Defense.notNull(servletPath, "servletPath");
 71  320 Defense.notNull(parameters, "parameters");
 72   
 73  320 _servletPath = servletPath;
 74  320 _pathInfo = pathInfo;
 75   
 76  320 _parameters = parameters;
 77    }
 78   
 79  8 public String getParameterValue(String name)
 80    {
 81  8 return _parameters.getParameterValue(name);
 82    }
 83   
 84  2 public String[] getParameterValues(String name)
 85    {
 86  2 return _parameters.getParameterValues(name);
 87    }
 88   
 89  4 public void setServletPath(String servletPath)
 90    {
 91  4 Defense.notNull(servletPath, "servletPath");
 92   
 93  4 _servletPath = servletPath;
 94  4 _modified = true;
 95    }
 96   
 97  10 public void setParameterValue(String name, String value)
 98    {
 99  10 _parameters.setParameterValue(name, value);
 100   
 101  10 _modified = true;
 102    }
 103   
 104  2 public void setParameterValues(String name, String[] values)
 105    {
 106  2 _parameters.setParameterValues(name, values);
 107   
 108  2 _modified = true;
 109    }
 110   
 111  193 public String getServletPath()
 112    {
 113  193 return _servletPath;
 114    }
 115   
 116  1 public String[] getParameterNames()
 117    {
 118  1 return _parameters.getParameterNames();
 119    }
 120   
 121  0 public String getPathInfo()
 122    {
 123  0 return _pathInfo;
 124    }
 125    }