Clover coverage report - Code Coverage for hivemind-lib release 1.1-beta-1
Coverage timestamp: Thu Apr 28 2005 19:55:00 EDT
file stats: LOC: 54   Methods: 0
NCLOC: 5   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
ChainBuilder.java - - - -
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.hivemind.lib.chain;
 16   
 
 17   
 import java.util.List;
 18   
 
 19   
 /**
 20   
  * Service interface for <code>hivemind.lib.ChainBuilder</code>, a service which can assemble an
 21   
  * implementation based on a command interface, and an ordered list of objects implementing that
 22   
  * interface (the "commands"). This is an implementation of the Gang of Four Chain Of Command
 23   
  * pattern.
 24   
  * <p>
 25   
  * For each method in the interface, the chain implementation will call the corresponding method on
 26   
  * each command object in turn. If any of the command objects return true, then the chain of command
 27   
  * stops and the initial method invocation returns true. Otherwise, the chain of command continues
 28   
  * to the next command (and will return false if none of the commands returns true).
 29   
  * <p>
 30   
  * For methods whose return type is not boolean, the chain stops with the first non-null (for object
 31   
  * types), or non-zero (for numeric types). The chain returns the value that was returned by the
 32   
  * command. The chain If the method return type is void, all command will be invoked.
 33   
  * <p>
 34   
  * Method invocations will also be terminated if an exception is thrown.
 35   
  * 
 36   
  * @author Howard M. Lewis Ship
 37   
  * @since 1.1
 38   
  */
 39   
 public interface ChainBuilder
 40   
 {
 41   
     /**
 42   
      * Builds an implementation.
 43   
      * 
 44   
      * @param commandInterface
 45   
      *            the interface the implementation implements.
 46   
      * @param commands
 47   
      *            a non-null list of command objects implementing the interface.
 48   
      * @param toString
 49   
      *            The value to be returned from the implementation's <code>toString()</code>
 50   
      *            method (unless <code>toString()</code> is expressly part of the service
 51   
      *            interface, in which case it is treated as any other method.
 52   
      */
 53   
     public Object buildImplementation(Class commandInterface, List commands, String toString);
 54   
 }