1 /***************************************************************************** 2 * Copyright (C) Codehaus.org. All rights reserved. * 3 * ------------------------------------------------------------------------- * 4 * The software in this package is published under the terms of the BSD * 5 * style license a copy of which has been included with this distribution in * 6 * the LICENSE.txt file. * 7 *****************************************************************************/ 8 /* 9 * Created on Feb 28, 2005 10 * 11 * Author Ben Yu 12 * ZBS 13 */ 14 package jfun.yan.function; 15 16 /** 17 * Function abstracts the concept of any invokable entity. 18 * that has typed parameters and return values. 19 * java.lang.reflect.Method and java.lang.reflect.Constructor 20 * are the two entities made implementation of this interface. 21 * <p> 22 * 23 * Codehaus.org. 24 * 25 * @author Ben Yu 26 * 27 */ 28 public interface Function<T> extends java.io.Serializable, Signature<T>{ 29 /** 30 * To determine if the type returned by getReturnType() is the concrete type 31 * of the real return value. 32 * <p> 33 * Static type check will be performed on concrete types. 34 * </p> 35 */ 36 boolean isConcrete(); 37 /** 38 * Gets the return type of the function. 39 * @return the return type. 40 */ 41 Class<T> getReturnType(); 42 /** 43 * Gets the parameter types of the function. 44 * @return the parameter types. 45 */ 46 Class[] getParameterTypes(); 47 /** 48 * Invoke this function. 49 * @param args the arguments. 50 * @return the return value. 51 */ 52 T call(Object[] args) 53 throws Throwable; 54 /** 55 * Get the name of the signature. 56 */ 57 public String getName(); 58 } 59