Clover coverage report - Code Coverage for tapestry release 4.0-beta-6
Coverage timestamp: Wed Sep 7 2005 18:41:34 EDT
file stats: LOC: 71   Methods: 4
NCLOC: 34   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ExpressionBeanInitializer.java - 0% 0% 0%
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.bean;
 16   
 17    import org.apache.hivemind.ApplicationRuntimeException;
 18    import org.apache.tapestry.IBeanProvider;
 19    import org.apache.tapestry.IComponent;
 20    import org.apache.tapestry.services.ExpressionEvaluator;
 21   
 22    /**
 23    * Initializes a helper bean property from an OGNL expression (relative to the bean's
 24    * {@link IComponent}).
 25    *
 26    * @author Howard Lewis Ship
 27    * @since 2.2
 28    */
 29   
 30    public class ExpressionBeanInitializer extends AbstractBeanInitializer
 31    {
 32    protected String _expression;
 33   
 34    private final ExpressionEvaluator _evaluator;
 35   
 36  0 public ExpressionBeanInitializer(ExpressionEvaluator evaluator)
 37    {
 38  0 _evaluator = evaluator;
 39    }
 40   
 41  0 public void setBeanProperty(IBeanProvider provider, Object bean)
 42    {
 43  0 IComponent component = provider.getComponent();
 44   
 45  0 try
 46    {
 47  0 Object value = _evaluator.read(component, _expression);
 48   
 49  0 setBeanProperty(bean, value);
 50    }
 51    catch (Exception ex)
 52    {
 53  0 throw new ApplicationRuntimeException(ex.getMessage(), getLocation(), ex);
 54    }
 55    }
 56   
 57    /** @since 3.0 * */
 58   
 59  0 public String getExpression()
 60    {
 61  0 return _expression;
 62    }
 63   
 64    /** @since 3.0 * */
 65   
 66  0 public void setExpression(String expression)
 67    {
 68  0 _expression = expression;
 69    }
 70   
 71    }