}
private boolean processScalarFunction(Method method)
throws IllegalAccessException
{
ScalarFunction scalarFunction = method.getAnnotation(ScalarFunction.class);
if (scalarFunction == null) {
return false;
}
checkValidMethod(method);
MethodHandle methodHandle = lookup().unreflect(method);
String name = scalarFunction.value();
if (name.isEmpty()) {
name = camelToSnake(method.getName());
}
SqlType returnTypeAnnotation = method.getAnnotation(SqlType.class);
checkArgument(returnTypeAnnotation != null, "Method %s return type does not have a @SqlType annotation", method);
Type returnType = type(typeManager, returnTypeAnnotation);
Signature signature = new Signature(name.toLowerCase(), returnType.getName(), Lists.transform(parameterTypes(typeManager, method), nameGetter()));
verifyMethodSignature(method, signature.getReturnType(), signature.getArgumentTypes(), typeManager);
List<Boolean> nullableArguments = getNullableArguments(method);
scalar(signature, methodHandle, scalarFunction.deterministic(), getDescription(method), scalarFunction.hidden(), method.isAnnotationPresent(Nullable.class), nullableArguments);
for (String alias : scalarFunction.alias()) {
scalar(signature.withAlias(alias.toLowerCase()), methodHandle, scalarFunction.deterministic(), getDescription(method), scalarFunction.hidden(), method.isAnnotationPresent(Nullable.class), nullableArguments);
}
return true;
}