Clover coverage report - Code Coverage for tapestry release 4.0-alpha-3
Coverage timestamp: Mon May 16 2005 09:05:49 EDT
file stats: LOC: 103   Methods: 6
NCLOC: 49   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
PropertyChangeImpl.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.record;
 16   
 
 17   
 import org.apache.commons.lang.builder.EqualsBuilder;
 18   
 import org.apache.commons.lang.builder.ToStringBuilder;
 19   
 import org.apache.hivemind.util.Defense;
 20   
 
 21   
 /**
 22   
  * Represents a change to a component on a page.
 23   
  * 
 24   
  * @author Howard Lewis Ship
 25   
  */
 26   
 
 27   
 public class PropertyChangeImpl implements PropertyChange
 28   
 {
 29   
     private String _componentPath;
 30   
 
 31   
     private String _propertyName;
 32   
 
 33   
     private Object _newValue;
 34   
 
 35  86
     public PropertyChangeImpl(String componentPath, String propertyName, Object newValue)
 36   
     {
 37  86
         Defense.notNull(propertyName, "propertyName");
 38   
 
 39   
         // TODO: This breaks some tests, but those tests are wrong.
 40   
         // Defense.notNull(newValue, "newValue");
 41   
 
 42  86
         _componentPath = componentPath;
 43  86
         _propertyName = propertyName;
 44  86
         _newValue = newValue;
 45   
     }
 46   
 
 47   
     /**
 48   
      * The path to the component on the page, or null if the property is a property of the page.
 49   
      */
 50   
 
 51  51
     public String getComponentPath()
 52   
     {
 53  51
         return _componentPath;
 54   
     }
 55   
 
 56   
     /**
 57   
      * The new value for the property, which may be null.
 58   
      */
 59   
 
 60  51
     public Object getNewValue()
 61   
     {
 62  51
         return _newValue;
 63   
     }
 64   
 
 65   
     /**
 66   
      * The name of the property that changed.
 67   
      */
 68   
 
 69  51
     public String getPropertyName()
 70   
     {
 71  51
         return _propertyName;
 72   
     }
 73   
 
 74  1
     public String toString()
 75   
     {
 76  1
         ToStringBuilder builder = new ToStringBuilder(this);
 77   
 
 78  1
         builder.append("componentPath", _componentPath);
 79  1
         builder.append("propertyName", _propertyName);
 80  1
         builder.append("newValue", _newValue);
 81   
 
 82  1
         return builder.toString();
 83   
     }
 84   
 
 85  31
     public boolean equals(Object object)
 86   
     {
 87  31
         if (this == object)
 88  1
             return true;
 89   
 
 90  30
         if (object == null || object.getClass() != this.getClass())
 91  1
             return false;
 92   
 
 93  29
         PropertyChangeImpl other = (PropertyChangeImpl) object;
 94   
 
 95  29
         EqualsBuilder builder = new EqualsBuilder();
 96   
 
 97  29
         builder.append(_componentPath, other._componentPath);
 98  29
         builder.append(_propertyName, other._propertyName);
 99  29
         builder.append(_newValue, other._newValue);
 100   
 
 101  29
         return builder.isEquals();
 102   
     }
 103   
 }