Clover coverage report - Code Coverage for tapestry release 4.0.1
Coverage timestamp: Fri Mar 31 2006 09:12:14 EST
file stats: LOC: 56   Methods: 2
NCLOC: 24   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
CreatePropertyWorker.java - 100% 100% 100%
coverage
 1    // Copyright 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.test;
 16   
 17    import org.apache.hivemind.Location;
 18    import org.apache.tapestry.enhance.EnhanceUtils;
 19    import org.apache.tapestry.enhance.EnhancementOperation;
 20    import org.apache.tapestry.enhance.EnhancementWorker;
 21    import org.apache.tapestry.spec.IComponentSpecification;
 22   
 23    /**
 24    * Forces the creation of a property, overrriding an existing implementation. Allows test code to
 25    * set the specification and messages properties of components.
 26    *
 27    * @author Howard M. Lewis Ship
 28    * @since 4.0
 29    */
 30    public class CreatePropertyWorker implements EnhancementWorker
 31    {
 32    private final String _propertyName;
 33   
 34    private final Location _location;
 35   
 36  648 public CreatePropertyWorker(String propertyName, Location location)
 37    {
 38  648 _propertyName = propertyName;
 39  648 _location = location;
 40    }
 41   
 42  680 public void performEnhancement(EnhancementOperation op, IComponentSpecification spec)
 43    {
 44  680 Class propertyType = EnhanceUtils.extractPropertyType(op, _propertyName, null);
 45   
 46  680 op.claimProperty(_propertyName);
 47   
 48  680 String field = "_$" + _propertyName;
 49   
 50  680 op.addField(field, propertyType);
 51   
 52  680 EnhanceUtils.createSimpleAccessor(op, field, _propertyName, propertyType, _location);
 53   
 54  680 EnhanceUtils.createSimpleMutator(op, field, _propertyName, propertyType, _location);
 55    }
 56    }