/** * Affirms if the given method signature matches bean-style getter method * signature.<br> * <code> public T getXXX()</code> where T is any non-void type.<br> * or<br> * <code> public T isXXX()</code> where T is boolean or Boolean.<br> */ public static boolean isGetter(Method method, boolean includePrivate) { if (method == null) return false; int mods = method.getModifiers(); if (!(Modifier.isPublic(mods) || Modifier.isProtected(mods) || (Modifier.isPrivate(mods) && includePrivate)) || Modifier.isNative(mods) || Modifier.isStatic(mods)) return false; return isNormalGetter(method) || isBooleanGetter(method); }
/** * Affirms if the given method signature matches bean-style getter method * signature.<br> * <code> public T getXXX()</code> where T is any non-void type.<br> * or<br> * <code> public T isXXX()</code> where T is boolean or Boolean.<br> */ public static boolean isGetter(Method method, boolean includePrivate) { if (method == null) return false; int mods = method.getModifiers(); if (!(Modifier.isPublic(mods) || Modifier.isProtected(mods) || (Modifier.isPrivate(mods) && includePrivate)) || Modifier.isNative(mods) || Modifier.isStatic(mods)) return false; return isNormalGetter(method) || isBooleanGetter(method); }
/** * Affirms if the given method signature matches bean-style getter method * signature.<br> * <code> public T getXXX()</code> where T is any non-void type.<br> * or<br> * <code> public T isXXX()</code> where T is boolean or Boolean.<br> */ public static boolean isGetter(Method method, boolean includePrivate) { if (method == null) return false; int mods = method.getModifiers(); if (!(Modifier.isPublic(mods) || Modifier.isProtected(mods) || (Modifier.isPrivate(mods) && includePrivate)) || Modifier.isNative(mods) || Modifier.isStatic(mods)) return false; return isNormalGetter(method) || isBooleanGetter(method); }
/** * Affirms if the given method signature matches bean-style getter method * signature.<br> * <code> public T getXXX()</code> where T is any non-void type.<br> * or<br> * <code> public T isXXX()</code> where T is boolean or Boolean.<br> */ public static boolean isGetter(Method method, boolean includePrivate) { if (method == null) return false; int mods = method.getModifiers(); if (!(Modifier.isPublic(mods) || Modifier.isProtected(mods) || (Modifier.isPrivate(mods) && includePrivate)) || Modifier.isNative(mods) || Modifier.isStatic(mods)) return false; return isNormalGetter(method) || isBooleanGetter(method); }
/** * Return the field name for the given member. This will only be invoked * on members of the right type (field vs. method). Return null if the * member cannot be managed. Default behavior: For fields, returns the * field name. For getter methods, returns the minus "get" or "is" with * the next letter lower-cased. For other methods, returns null. */ public static String getFieldName(Member member) { if (member instanceof Field) return member.getName(); if (member instanceof Method == false) return null; Method method = (Method) member; String name = method.getName(); if (isNormalGetter(method)) name = name.substring("get".length()); else if (isBooleanGetter(method)) name = name.substring("is".length()); else return null; if (name.length() == 1) return name.toLowerCase(); return Character.toLowerCase(name.charAt(0)) + name.substring(1); }
/** * Return the field name for the given member. This will only be invoked * on members of the right type (field vs. method). Return null if the * member cannot be managed. Default behavior: For fields, returns the * field name. For getter methods, returns the minus "get" or "is" with * the next letter lower-cased. For other methods, returns null. */ public static String getFieldName(Member member) { if (member instanceof Field) return member.getName(); if (member instanceof Method == false) return null; Method method = (Method) member; String name = method.getName(); if (isNormalGetter(method)) name = name.substring("get".length()); else if (isBooleanGetter(method)) name = name.substring("is".length()); else return null; if (name.length() == 1) return name.toLowerCase(); return Character.toLowerCase(name.charAt(0)) + name.substring(1); }
/** * Return the field name for the given member. This will only be invoked * on members of the right type (field vs. method). Return null if the * member cannot be managed. Default behavior: For fields, returns the * field name. For getter methods, returns the minus "get" or "is" with * the next letter lower-cased. For other methods, returns null. */ public static String getFieldName(Member member) { if (member instanceof Field) return member.getName(); if (member instanceof Method == false) return null; Method method = (Method) member; String name = method.getName(); if (isNormalGetter(method)) name = name.substring("get".length()); else if (isBooleanGetter(method)) name = name.substring("is".length()); else return null; if (name.length() == 1) return name.toLowerCase(); return Character.toLowerCase(name.charAt(0)) + name.substring(1); }
/** * Return the field name for the given member. This will only be invoked * on members of the right type (field vs. method). Return null if the * member cannot be managed. Default behavior: For fields, returns the * field name. For getter methods, returns the minus "get" or "is" with * the next letter lower-cased. For other methods, returns null. */ public static String getFieldName(Member member) { if (member instanceof Field) return member.getName(); if (member instanceof Method == false) return null; Method method = (Method) member; String name = method.getName(); if (isNormalGetter(method)) name = name.substring("get".length()); else if (isBooleanGetter(method)) name = name.substring("is".length()); else return null; if (name.length() == 1) return name.toLowerCase(); return Character.toLowerCase(name.charAt(0)) + name.substring(1); }