checkMethodType function switch statement instead of if statement