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
-
Method Summary
Modifier and TypeMethodDescriptionClass<?>
Returns the type declaring theFunction
.getName()
Returns the name of the function.int
Returns the number of parameters required by the underlying method.Invokes the function with the given arguments.boolean
isSignatureEqual
(Function other) Checks whether thisFunction
has the same signature as anotherFunction
.boolean
Returns true if the function can be called with the givenargumentTypes
.boolean
supportsExact
(List<org.springframework.core.convert.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 newFunction
for 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 ofTypeDescriptor
s to compare with the argument types of the method- Returns:
true
if the types are equal,false
otherwise.
-
isSignatureEqual
Checks whether thisFunction
has the same signature as anotherFunction
.- Parameters:
other
- theFunction
to comparethis
with.- Returns:
true
if name and argument list are the same.
-