Class Function
java.lang.Object
org.springframework.data.spel.spi.Function
Value object to represent a function. Can either be backed by a static
Method invocation (see
Function(Method)) or a method invocation on an instance (see Function(Method, Object).- Since:
- 1.9
- Author:
- Thomas Darimont, Oliver Gierke, Jens Schauder, Johannes Englmeier
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionClass<?>Returns the type declaring theFunction.getName()Returns the name of the function.intReturns the number of parameters required by the underlying method.@Nullable ObjectInvokes the function with the given arguments.booleanisSignatureEqual(Function other) Checks whether thisFunctionhas the same signature as anotherFunction.booleansupports(List<TypeDescriptor> argumentTypes) Returns true if the function can be called with the givenargumentTypes.booleansupportsExact(List<TypeDescriptor> argumentTypes) Checks if the encapsulated method has exactly the argument types as those passed as an argument.
-
Constructor Details
-
Function
- Parameters:
method-
-
Function
Creates a newFunctionfor the given method on the given target instance.- Parameters:
method- must not be null.target- can be null, if so, the method
-
-
Method Details
-
invoke
Invokes the function with the given arguments.- Parameters:
arguments- must not be null.- Returns:
- Throws:
Exception
-
getName
Returns the name of the function.- Returns:
-
getDeclaringClass
Returns the type declaring theFunction.- Returns:
-
supports
Returns true if the function can be called with the givenargumentTypes.- Parameters:
argumentTypes-- Returns:
-
getParameterCount
public int getParameterCount()Returns the number of parameters required by the underlying method.- Returns:
-
supportsExact
Checks if the encapsulated method has exactly the argument types as those passed as an argument.- Parameters:
argumentTypes- a list ofTypeDescriptors to compare with the argument types of the method- Returns:
trueif the types are equal,falseotherwise.
-
isSignatureEqual
Checks whether thisFunctionhas the same signature as anotherFunction.- Parameters:
other- theFunctionto comparethiswith.- Returns:
trueif name and argument list are the same.
-