public abstract class Function extends Object implements Serializable
Interface for anything that can be invoked. Every function has a name, a return type, and parameter types. Invocations takes an array with the number of parameters. Each element must be assignable to the corresponding argument types. Invocations return an Object assignable to the function's return type. Use Object types to get around "static" type checking.
Note: Java reflection automatically wraps and unwraps primitive types, but not arrays of primitive types.| Modifier and Type | Field and Description |
|---|---|
static Class<?>[] |
NO_CLASSES |
| Constructor and Description |
|---|
Function() |
| Modifier and Type | Method and Description |
|---|---|
abstract Class<?>[] |
getExceptionTypes() |
abstract String |
getName()
Gets the Function name.
|
abstract Class<?>[] |
getParameterTypes()
Gets the parameter types of this function.
|
abstract Class<?> |
getReturnType()
Gets the return type of this Function.
|
abstract Object |
invoke(Object[] vals)
Invokes the function.
|
Object |
invokeN() |
Object |
invokeN(Object a) |
Object |
invokeN(Object a,
Object b) |
Object |
invokeN(Object a,
Object b,
Object c) |
boolean |
matches(Class<?>[] args)
Tests if the functions can be called with arguments of the
specified types.
|
String |
toString()
Gets a String representation for this Function.
|
abstract void |
translate(Code dest)
Generate bytecode equivalent to invoke().
|
public static final Class<?>[] NO_CLASSES
public abstract String getName()
public abstract Class<?> getReturnType()
public abstract Class<?>[] getParameterTypes()
public abstract Class<?>[] getExceptionTypes()
public abstract Object invoke(Object[] vals) throws InvocationTargetException
vals - arguments to call the Function with; length
and types must conform the argument count and the
argument types of the FunctionInvocationTargetExceptionpublic Object invokeN() throws InvocationTargetException
InvocationTargetExceptionpublic Object invokeN(Object a) throws InvocationTargetException
InvocationTargetExceptionpublic Object invokeN(Object a, Object b) throws InvocationTargetException
InvocationTargetExceptionpublic Object invokeN(Object a, Object b, Object c) throws InvocationTargetException
InvocationTargetExceptionpublic boolean matches(Class<?>[] args)
args - arguement typespublic String toString()
public abstract void translate(Code dest)
Copyright © 1998–2017 1&1. All rights reserved.