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: 53   Methods: 2
NCLOC: 20   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
SyntheticListener.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.listener;
 16   
 17    import org.apache.hivemind.util.Defense;
 18    import org.apache.tapestry.IActionListener;
 19    import org.apache.tapestry.IComponent;
 20    import org.apache.tapestry.IRequestCycle;
 21   
 22    /**
 23    * Adapter class that combines a target object (typically, a component) with a
 24    * {@link org.apache.tapestry.listener.ListenerMethodInvoker}. This is the bridge from listener
 25    * method names to listener method invocations.
 26    * <p>
 27    * TODO: It would really be nice if we could get the location of the listener binding into thrown
 28    * exceptions. As implemented, as best, it will be the location of the &lt;page-specification&gt;
 29    * (or &lt;component&gt;) of the page (or component) containing the listener method.
 30    *
 31    * @author Howard M. Lewis Ship
 32    * @since 4.0
 33    */
 34    public class SyntheticListener implements IActionListener
 35    {
 36    private final Object _target;
 37   
 38    private final ListenerMethodInvoker _invoker;
 39   
 40  38 public SyntheticListener(Object target, ListenerMethodInvoker invoker)
 41    {
 42  38 Defense.notNull(target, "target");
 43  38 Defense.notNull(invoker, "invoker");
 44   
 45  38 _target = target;
 46  38 _invoker = invoker;
 47    }
 48   
 49  53 public void actionTriggered(IComponent component, IRequestCycle cycle)
 50    {
 51  53 _invoker.invokeListenerMethod(_target, cycle);
 52    }
 53    }