Package org.apache.pinot.common.function
Class FunctionInvoker
- java.lang.Object
-
- org.apache.pinot.common.function.FunctionInvoker
-
public class FunctionInvoker extends Object
TheFunctionInvokeris a wrapper on a java method which supports arguments type conversion and method invocation via reflection.
-
-
Constructor Summary
Constructors Constructor Description FunctionInvoker(FunctionInfo functionInfo)
-
Method Summary
Modifier and Type Method Description voidconvertTypes(Object[] arguments)Converts the type of the given arguments to match the parameter classes.MethodgetMethod()Returns the underlying java method.Class<?>[]getParameterClasses()Returns the class of the parameters.PinotDataType[]getParameterTypes()Returns the PinotDataType of the parameters for type conversion purpose.Class<?>getResultClass()Returns the class of the result value.Objectinvoke(Object[] arguments)Invoke the function with the given arguments.
-
-
-
Constructor Detail
-
FunctionInvoker
public FunctionInvoker(FunctionInfo functionInfo)
-
-
Method Detail
-
getMethod
public Method getMethod()
Returns the underlying java method.
-
getParameterClasses
public Class<?>[] getParameterClasses()
Returns the class of the parameters.
-
getParameterTypes
public PinotDataType[] getParameterTypes()
Returns the PinotDataType of the parameters for type conversion purpose. Putsnullfor the parameter class that does not support type conversion.
-
convertTypes
public void convertTypes(Object[] arguments)
Converts the type of the given arguments to match the parameter classes. Leaves the argument as is if type conversion is not needed or supported.
-
getResultClass
public Class<?> getResultClass()
Returns the class of the result value.
-
invoke
public Object invoke(Object[] arguments)
Invoke the function with the given arguments. The arguments should match the parameter classes. UseconvertTypes(Object[])to convert the argument types if needed before calling this method.
-
-