public class Function extends Object
Method
invocation (see
Function(Method)
) or a method invocation on an instance (see Function(Method, Object)
.Constructor and Description |
---|
Function(Method method)
|
Function(Method method,
Object target)
Creates a new
Function for the given method on the given target instance. |
Modifier and Type | Method and Description |
---|---|
Class<?> |
getDeclaringClass()
Returns the type declaring the
Function . |
String |
getName()
Returns the name of the function.
|
int |
getParameterCount()
Returns the number of parameters required by the underlying method.
|
Object |
invoke(Object[] arguments)
Invokes the function with the given arguments.
|
boolean |
isSignatureEqual(Function other)
Checks whether this
Function has the same signature as another Function . |
boolean |
supports(List<TypeDescriptor> argumentTypes)
Returns true if the function can be called with the given
argumentTypes . |
boolean |
supportsExact(List<TypeDescriptor> argumentTypes)
Checks if the encapsulated method has exactly the argument types as those passed as an argument.
|
public Function(Method method)
method
- public Object invoke(Object[] arguments) throws Exception
arguments
- must not be null.Exception
public String getName()
public Class<?> getDeclaringClass()
Function
.public boolean supports(List<TypeDescriptor> argumentTypes)
argumentTypes
.argumentTypes
- public int getParameterCount()
public boolean supportsExact(List<TypeDescriptor> argumentTypes)
argumentTypes
- a list of TypeDescriptor
s to compare with the argument types of the methodtrue
if the types are equal, false
otherwise.public boolean isSignatureEqual(Function other)
Function
has the same signature as another Function
.other
- the Function
to compare this
with.true
if name and argument list are the same.Copyright © 2011–2019 Pivotal Software, Inc.. All rights reserved.