@Test public void hasBeanMethods() { Assert.assertEquals(false, ClassUtil.hasBeanMethods(InternetPerson.class, "email2", String.class, false)); Assert.assertEquals(false, ClassUtil.hasBeanMethods(InternetPerson.class, "Email2", String.class, true)); Assert.assertEquals(false, ClassUtil.hasBeanMethods(InternetPerson.class, "blash", String.class, true)); Assert.assertEquals(false, ClassUtil.hasBeanMethods(InternetPerson.class, "blash", String.class, false)); Assert.assertEquals(true, ClassUtil.hasBeanMethods(InternetPerson.class, "LastName", String.class, true)); Assert.assertEquals(true, ClassUtil.hasBeanMethods(InternetPerson.class, "FirstName", String.class, true)); Assert.assertEquals(true, ClassUtil.hasBeanMethods(InternetPerson.class, "Email", String.class, true)); }
public static boolean hasBeanMethods(Class<?> type, String propertyName, Class<?> propertyType, boolean caseSensitive) { try { @SuppressWarnings("unused") Method[] methods = getBeanMethods(type, propertyName, propertyType, caseSensitive); return true; } catch (Exception e) { return false; } }
ClassUtil { public static boolean hasBeanMethods(Class<?> type, String propertyName, Class<?> propertyType, boolean caseSensitive) { try { @SuppressWarnings("unused") Method[] methods = getBeanMethods(type, propertyName, propertyType, caseSensitive); return true; } catch (Exception e) { return false; } } }
ClassUtil { public static boolean hasBeanMethods(Class<?> type, String propertyName, Class<?> propertyType, boolean caseSensitive) { try { @SuppressWarnings("unused") Method[] methods = getBeanMethods(type, propertyName, propertyType, caseSensitive); return true; } catch (Exception e) { return false; } }  }
ClassUtil { public static boolean hasBeanMethods(Class<?> type, String propertyName, Class<?> propertyType, boolean caseSensitive) { try { @SuppressWarnings("unused") Method[] methods = getBeanMethods(type, propertyName, propertyType, caseSensitive); return true; } catch (Exception e) { return false; } }  static Object findEnumConstant(Class<?> type, String constantName); static Object findEnumConstant(Class<?> type, String constantName, boolean caseSensitive); static Class<?>[] getClassHierarchy(Class<?> type); static boolean hasBeanMethods(Class<?> type, String propertyName, Class<?> propertyType, boolean caseSensitive); static Method[] getBeanMethods(Class<?> type, String propertyName, Class<?> propertyType, boolean caseSensitive); static Method getMethod(Class<?> type, String name, Class<?> returnType, Class<?> paramType, boolean caseSensitive); }
ClassUtil { public static boolean hasBeanMethods(Class<?> type, String propertyName, Class<?> propertyType, boolean caseSensitive) { try { @SuppressWarnings("unused") Method[] methods = getBeanMethods(type, propertyName, propertyType, caseSensitive); return true; } catch (Exception e) { return false; } }  static Object findEnumConstant(Class<?> type, String constantName); static Object findEnumConstant(Class<?> type, String constantName, boolean caseSensitive); static Class<?>[] getClassHierarchy(Class<?> type); static boolean hasBeanMethods(Class<?> type, String propertyName, Class<?> propertyType, boolean caseSensitive); static Method[] getBeanMethods(Class<?> type, String propertyName, Class<?> propertyType, boolean caseSensitive); static Method getMethod(Class<?> type, String name, Class<?> returnType, Class<?> paramType, boolean caseSensitive);  }