Clover coverage report - Code Coverage for tapestry release 4.0-beta-9
Coverage timestamp: Sat Oct 1 2005 08:36:20 EDT
file stats: LOC: 64   Methods: 2
NCLOC: 22   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ListenerMapPropertyAccessor.java 25% 40% 50% 37.5%
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.listener;
 16   
 17    import java.util.Map;
 18   
 19    import ognl.ObjectPropertyAccessor;
 20    import ognl.OgnlException;
 21   
 22    /**
 23    * Exposes {@link org.apache.tapestry.IActionListener} listeners provided by the
 24    * {@link org.apache.tapestry.listener.ListenerMap} as read-only properties of the map.
 25    *
 26    * @author Howard Lewis Ship
 27    * @since 2.2
 28    */
 29   
 30    public class ListenerMapPropertyAccessor extends ObjectPropertyAccessor
 31    {
 32    /**
 33    * Checks to see if the ListenerMapImpl provides the named listener, returning the listener if
 34    * it does. Otherwise, invokes the super implementation.
 35    */
 36   
 37  5 public Object getProperty(Map context, Object target, Object name) throws OgnlException
 38    {
 39  5 ListenerMap map = (ListenerMap) target;
 40  5 String listenerName = (String) name;
 41   
 42  5 if (map.canProvideListener(listenerName))
 43  5 return map.getListener(listenerName);
 44   
 45  0 return super.getProperty(context, target, name);
 46    }
 47   
 48    /**
 49    * Returns true if the ListenerMap contains the named listener, otherwise invokes
 50    * super-implementation.
 51    */
 52   
 53  0 public boolean hasGetProperty(Map context, Object target, Object oname) throws OgnlException
 54    {
 55  0 ListenerMap map = (ListenerMap) target;
 56  0 String listenerName = (String) oname;
 57   
 58  0 if (map.canProvideListener(listenerName))
 59  0 return true;
 60   
 61  0 return super.hasGetProperty(context, target, oname);
 62    }
 63   
 64    }