test_class.declarator: logger = LoggerFactory.getLogger(ClassUtilTest.class)
test_class.modifier: private static final
test_class.original_string: private static final Logger logger = LoggerFactory.getLogger(ClassUtilTest.class);
test_class.type: Logger
test_class.var_name: logger
test_class.file: ch-commons-util/src/test/java/com/cloudhopper/commons/util/ClassUtilTest.java
test_class.identifier: ClassUtilTest
test_case.body: @Test(expected=NoSuchMethodException.class)
      public void getMethodCaseSensitiveBadParameterType() throws Exception {
          Method m = ClassUtil.getMethod(InternetPerson.class, "getLastName", String.class, String.class, true);
      }
test_case.class_method_signature: ClassUtilTest.getMethodCaseSensitiveBadParameterType()
test_case.full_signature: @Test(expected=NoSuchMethodException.class) public void getMethodCaseSensitiveBadParameterType()
test_case.identifier: getMethodCaseSensitiveBadParameterType
test_case.invocations: getMethod
test_case.modifiers: @Test(expected=NoSuchMethodException.class) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void getMethodCaseSensitiveBadParameterType()
focal_class.file: ch-commons-util/src/main/java/com/cloudhopper/commons/util/ClassUtil.java
focal_class.identifier: ClassUtil
focal_class.class_method_signature: ClassUtil.findEnumConstant(Class<?> type, String constantName)
focal_class.full_signature: public static Object findEnumConstant(Class<?> type, String constantName)
focal_class.identifier: findEnumConstant
focal_class.modifiers: public static
focal_class.parameters: (Class<?> type, String constantName)
focal_class.return: Object
focal_class.signature: Object findEnumConstant(Class<?> type, String constantName)
focal_class.class_method_signature: ClassUtil.findEnumConstant(Class<?> type, String constantName, boolean caseSensitive)
focal_class.full_signature: public static Object findEnumConstant(Class<?> type, String constantName, boolean caseSensitive)
focal_class.identifier: findEnumConstant
focal_class.modifiers: public static
focal_class.parameters: (Class<?> type, String constantName, boolean caseSensitive)
focal_class.return: Object
focal_class.signature: Object findEnumConstant(Class<?> type, String constantName, boolean caseSensitive)
focal_class.class_method_signature: ClassUtil.getClassHierarchy(Class<?> type)
focal_class.full_signature: public static Class<?>[] getClassHierarchy(Class<?> type)
focal_class.identifier: getClassHierarchy
focal_class.modifiers: public static
focal_class.parameters: (Class<?> type)
focal_class.return: Class<?>[]
focal_class.signature: Class<?>[] getClassHierarchy(Class<?> type)
focal_class.class_method_signature: ClassUtil.hasBeanMethods(Class<?> type, String propertyName, Class<?> propertyType, boolean caseSensitive)
focal_class.full_signature: public static boolean hasBeanMethods(Class<?> type, String propertyName, Class<?> propertyType, boolean caseSensitive)
focal_class.identifier: hasBeanMethods
focal_class.modifiers: public static
focal_class.parameters: (Class<?> type, String propertyName, Class<?> propertyType, boolean caseSensitive)
focal_class.return: boolean
focal_class.signature: boolean hasBeanMethods(Class<?> type, String propertyName, Class<?> propertyType, boolean caseSensitive)
focal_class.class_method_signature: ClassUtil.getBeanMethods(Class<?> type, String propertyName, Class<?> propertyType, boolean caseSensitive)
focal_class.full_signature: public static Method[] getBeanMethods(Class<?> type, String propertyName, Class<?> propertyType, boolean caseSensitive)
focal_class.identifier: getBeanMethods
focal_class.modifiers: public static
focal_class.parameters: (Class<?> type, String propertyName, Class<?> propertyType, boolean caseSensitive)
focal_class.return: Method[]
focal_class.signature: Method[] getBeanMethods(Class<?> type, String propertyName, Class<?> propertyType, boolean caseSensitive)
focal_class.class_method_signature: ClassUtil.getMethod(Class<?> type, String name, Class<?> returnType, Class<?> paramType, boolean caseSensitive)
focal_class.full_signature: public static Method getMethod(Class<?> type, String name, Class<?> returnType, Class<?> paramType, boolean caseSensitive)
focal_class.identifier: getMethod
focal_class.modifiers: public static
focal_class.parameters: (Class<?> type, String name, Class<?> returnType, Class<?> paramType, boolean caseSensitive)
focal_class.return: Method
focal_class.signature: Method getMethod(Class<?> type, String name, Class<?> returnType, Class<?> paramType, boolean caseSensitive)
focal_method.body: public static Method getMethod(Class<?> type, String name, Class<?> returnType, Class<?> paramType, boolean caseSensitive)
          throws IllegalAccessException, NoSuchMethodException {
          
          // flag to help modify the exception to make it a little easier for debugging
          boolean methodNameFound = false;
  
          // start our search
          Class<?> classType = type;
  
          while (classType != null && !classType.equals(Object.class)) {
  
              for (Method m : classType.getDeclaredMethods()) {
  
                  if ((!caseSensitive && m.getName().equalsIgnoreCase(name)) || (caseSensitive && m.getName().equals(name))) {
  
                      // we found the method name, but its possible the signature won't
                      // match below, we'll set this flag to help construct a better exception
                      // below
                      methodNameFound = true;
  
                      // should we validate the return type?
                      if (returnType != null) {
                          // if the return types don't match, then this must be invalid
                          // since the JVM doesn't allow the same return type
                          if (!m.getReturnType().equals(returnType)) {
                              throw new NoSuchMethodException("Method '" + name + "' was found in " + type.getSimpleName() + ".class"
                                      + ", but the returnType " + m.getReturnType().getSimpleName() + ".class did not match expected " + returnType.getSimpleName() + ".class");
                          }
                      // make sure the return type is VOID
                      } else {
                          if (!m.getReturnType().equals(void.class)) {
                              throw new NoSuchMethodException("Method '" + name + "' was found in " + type.getSimpleName() + ".class"
                                      + ", but the returnType " + m.getReturnType().getSimpleName() + ".class was expected to be void");
                          }
                      }
  
                      // return type was okay, check the parameters
                      Class<?>[] paramTypes = m.getParameterTypes();
  
                      // should we check the parameter type?
                      if (paramType != null) {
                          // must have exactly 1 parameter
                          if (paramTypes.length != 1) {
                              // this might not be the method we want, keep searching
                              continue;
                          } else {
                              // if the parameters don't match, keep searching
                              if (!paramTypes[0].equals(paramType)) {
                                  continue;
                              }
                          }
                      // if paramType was null, then make sure no parameters are expected
                      } else {
                          if (paramTypes.length != 0) {
                              continue;
                          }
                      }
  
                      // if we got here, then everything matches so far
                      // now its time to check if the method is accessible
                      if (!Modifier.isPublic(m.getModifiers())) {
                          throw new IllegalAccessException("Method '" + name + "' was found in " + type.getSimpleName() + ".class "+
                                  ", but its not accessible since its " + Modifier.toString(m.getModifiers()));
                      }
  
                      // everything was okay
                      return m;
                  }
              }
  
              // move onto the superclass
              classType = classType.getSuperclass();
          }
  
          String signature = "public " + (returnType == null ? "void" : returnType.getName()) + " " + name + "(" + (paramType == null ? "" : paramType.getName()) + ")";
          
          if (methodNameFound) {
              throw new NoSuchMethodException("Method '" + signature + "' was found in " + type.getSimpleName() + ".class, but signature match failed");
          } else {
              throw new NoSuchMethodException("Method '" + signature + "' was not found in " + type.getSimpleName() + ".class");
          }
      }
focal_method.class_method_signature: ClassUtil.getMethod(Class<?> type, String name, Class<?> returnType, Class<?> paramType, boolean caseSensitive)
focal_method.full_signature: public static Method getMethod(Class<?> type, String name, Class<?> returnType, Class<?> paramType, boolean caseSensitive)
focal_method.identifier: getMethod
focal_method.invocations: equals getDeclaredMethods equalsIgnoreCase getName equals getName equals getReturnType getSimpleName getSimpleName getReturnType getSimpleName equals getReturnType getSimpleName getSimpleName getReturnType getParameterTypes equals isPublic getModifiers getSimpleName toString getModifiers getSuperclass getName getName getSimpleName getSimpleName
focal_method.modifiers: public static
focal_method.parameters: (Class<?> type, String name, Class<?> returnType, Class<?> paramType, boolean caseSensitive)
focal_method.return: Method
focal_method.signature: Method getMethod(Class<?> type, String name, Class<?> returnType, Class<?> paramType, boolean caseSensitive)