List of utility methods to do Reflection Method Getter Get
Map | getGetterMethods(Class> clazz) get Getter Methods if (isPrimite(clazz)) { return Collections.emptyMap(); Map<String, Method> result = cache.get(clazz); if (result == null) { result = createGetterMethods(clazz); cache.put(clazz, result); return result; |
List | getGetterMethods(Class> clazz) get Getter Methods List<Method> allMethods = new ArrayList<Method>(); do { try { allMethods.addAll(Arrays.asList(clazz.getDeclaredMethods())); } catch (Exception e) { } while ((clazz = clazz.getSuperclass()).getPackage().getName().startsWith("net.freedom.gj.example")); List<Method> getterMethods = new ArrayList<Method>(); ... |
List | getGetterMethods(Class> clazz) get Getter Methods List<Method> props = new ArrayList<Method>(); for (Method method : clazz.getMethods()) { String methodName = method.getName(); if (!methodName.equals("getClass") && GETTER_METHOD_NAME_PATTERN.matcher(methodName).find()) { props.add(method); return props; ... |
List | getGetterMethods(Class> objectType) get Getter Methods List<Method> result = new ArrayList<Method>(); Method[] methods = objectType.getMethods(); for (Method method : methods) { if (isValidGetterMethod(method)) { result.add(method); return result; ... |
Map | getGetterMethods(Class> pojoClass) Gets the getters of a pojo as a map of String as key and Method as value. HashMap<String, Method> methods = new HashMap<String, Method>(); fillGetterMethods(pojoClass, methods); return methods; |
List | getGetterMethods(final Class> clazz) get Getter Methods final List<Method> result = new ArrayList<Method>(); for (Method m : clazz.getMethods()) { if (m.getName().startsWith("get")) { if (m.getParameterTypes().length == 0) { result.add(m); return result; |
String | getGetterName(Field field) get Getter Name String name = field.getName(); if (field.getType().equals(boolean.class)) { return "is" + name.substring(0, 1).toUpperCase(Locale.US) + name.substring(1); } else { return "get" + name.substring(0, 1).toUpperCase(Locale.US) + name.substring(1); |
String | getGetterName(Field field) get Getter Name char[] fieldNameChars = field.getName().toCharArray(); fieldNameChars[0] = Character.toUpperCase(fieldNameChars[0]); String accessor = isBoolean(field.getType()) ? IS_ACCESSOR : GET_ACCESSOR; return accessor.concat(String.valueOf(fieldNameChars)); |
String | getGetterName(final Field field) get Getter Name return "get" + capitalizeFieldName(field); |
String | getGetterName(Method m) get Getter Name String name = m.getName(); if (name.substring(0, 3).equals("get")) name = name.substring(3); else if (name.substring(0, 2).equals("is")) name = name.substring(2); return name; |