Clover coverage report - Code Coverage for tapestry release 4.0.2
Coverage timestamp: Thu Apr 13 2006 10:52:06 EDT
file stats: LOC: 60   Methods: 2
NCLOC: 29   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
PropertyObjectProvider.java - 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.services.impl;
 16   
 17    import org.apache.hivemind.ApplicationRuntimeException;
 18    import org.apache.hivemind.Location;
 19    import org.apache.hivemind.internal.Module;
 20    import org.apache.hivemind.service.ObjectProvider;
 21    import org.apache.tapestry.engine.IPropertySource;
 22   
 23    /**
 24    * An implementation of {@link org.apache.hivemind.service.ObjectProvider}
 25    * that gets the actual value from the
 26    * <code>tapestry.GlobalPropertySource</code> service.
 27    *
 28    * @author Howard Lewis Ship
 29    * @since 4.0
 30    */
 31    public class PropertyObjectProvider implements ObjectProvider
 32    {
 33    private IPropertySource _source;
 34   
 35    /**
 36    * Gets the value; the locator is the key passed to
 37    * {@link IPropertySource#getPropertyValue(String)}.
 38    */
 39  215 public Object provideObject(
 40    Module contributingModule,
 41    Class propertyType,
 42    String locator,
 43    Location location)
 44    {
 45  215 try
 46    {
 47  215 return _source.getPropertyValue(locator);
 48    }
 49    catch (Exception ex)
 50    {
 51  1 throw new ApplicationRuntimeException(ex.getMessage(), location, ex);
 52    }
 53    }
 54   
 55  80 public void setSource(IPropertySource source)
 56    {
 57  80 _source = source;
 58    }
 59   
 60    }