1 /* 2 * This file is part of JGAP. 3 * 4 * JGAP offers a dual license model containing the LGPL as well as the MPL. 5 * 6 * For licencing information please see the file license.txt included with JGAP 7 * or have a look at the top of class org.jgap.Chromosome which representatively 8 * includes the JGAP license policy applicable for any file delivered with JGAP. 9 */ 10 package org.jgap; 11 12 /** 13 * Interface for handlers capable of doing somethign specific.<p> 14 * Such a handler acknowledges via isHandlerFor(Class) that the method 15 * perform(Object, Object) could be executed for the given class. 16 * 17 * @author Klaus Meffert 18 * @since 2.6 19 */ 20 public interface IHandler { 21 /** String containing the CVS revision. Read out via reflection!*/ 22 final static String CVS_REVISION = "$Revision: 1.2 $"; 23 24 /** 25 * Determines whether the handler is suitable for the given object instance 26 * or class. 27 * 28 * @param a_obj the object instance to check 29 * @param a_class the class to check, alternatively if no object instance is 30 * available (some handlers could need to get an object and would always 31 * return false if only a class is provided) 32 * @return true: handler suitable for given object or class 33 * 34 * @author Klaus Meffert 35 * @since 2.6 36 */ 37 boolean isHandlerFor(Object a_obj, Class a_class); 38 39 /** 40 * Performs a task for the given object or class. For some handlers, 41 * additional parameters are necessary, which could be provided. 42 * 43 * @param a_obj the object instance to perform the handler task for 44 * @param a_class the class to perform the handler task for, in case no object 45 * instance is available (some handlers could need to get an object and would 46 * always throw an exception if only a class is provided) 47 * @param a_params optional parameters needed for the handler to perform its 48 * task 49 * @throws Exception in case of any error 50 * @return Object 51 * 52 * @author Klaus Meffert 53 * @since 2.6 54 */ 55 Object perform(Object a_obj, Class a_class, Object a_params) 56 throws Exception; 57 } 58