}
private boolean processScalarOperator(Method method)
throws IllegalAccessException
{
ScalarOperator scalarOperator = method.getAnnotation(ScalarOperator.class);
if (scalarOperator == null) {
return false;
}
checkValidMethod(method);
MethodHandle methodHandle = lookup().unreflect(method);
OperatorType operatorType = scalarOperator.value();
List<Type> parameterTypes = parameterTypes(method);
Type returnType;
if (operatorType == OperatorType.HASH_CODE) {
// todo hack for hashCode... should be int
returnType = BIGINT;
}
else {
SqlType explicitType = method.getAnnotation(SqlType.class);
checkArgument(explicitType != null, "Method %s return type does not have a @SqlType annotation", method);
returnType = type(explicitType);
verifyMethodSignature(method, returnType, parameterTypes);
}
FunctionBinder functionBinder = createFunctionBinder(method, scalarOperator.functionBinder());
operator(operatorType, returnType, parameterTypes, methodHandle, functionBinder);
return true;
}