/** * Affirms if the original declaration the given field is annotated * for reflection. */ static boolean canReflect(Field field) { Class cls = field.getDeclaringClass(); return canReflect((Reflectable)cls.getAnnotation(Reflectable.class), field.getAnnotation(Reflectable.class)); }
/** * Affirms if the original declaration the given field is annotated * for reflection. */ static boolean canReflect(Field field) { Class cls = field.getDeclaringClass(); return canReflect((Reflectable)cls.getAnnotation(Reflectable.class), field.getAnnotation(Reflectable.class)); }
/** * Affirms if the original declaration the given field is annotated * for reflection. */ static boolean canReflect(Field field) { Class cls = field.getDeclaringClass(); return canReflect((Reflectable)cls.getAnnotation(Reflectable.class), field.getAnnotation(Reflectable.class)); }
/** * Affirms if the original declaration the given field is annotated * for reflection. */ static boolean canReflect(Field field) { Class cls = field.getDeclaringClass(); return canReflect((Reflectable)cls.getAnnotation(Reflectable.class), field.getAnnotation(Reflectable.class)); }
/** * Gets all public field names of the given Class. * */ public static Set<String> getPublicFieldNames(Class c) { if (c == null) return Collections.EMPTY_SET; Field[] fields = c.getFields(); if (fields == null || fields.length == 0) return Collections.EMPTY_SET; Set<String> result = new TreeSet<String>(); for (Field f : fields) { if (canReflect(f)) result.add(f.getName()); } return result; }
/** * Gets all public field names of the given Class. * */ public static Set<String> getPublicFieldNames(Class c) { if (c == null) return Collections.EMPTY_SET; Field[] fields = c.getFields(); if (fields == null || fields.length == 0) return Collections.EMPTY_SET; Set<String> result = new TreeSet<String>(); for (Field f : fields) { if (canReflect(f)) result.add(f.getName()); } return result; }
/** * Gets all public field names of the given Class. * */ public static Set<String> getPublicFieldNames(Class c) { if (c == null) return Collections.EMPTY_SET; Field[] fields = c.getFields(); if (fields == null || fields.length == 0) return Collections.EMPTY_SET; Set<String> result = new TreeSet<String>(); for (Field f : fields) { if (canReflect(f)) result.add(f.getName()); } return result; }
/** * Gets all public field names of the given Class. * */ public static Set<String> getPublicFieldNames(Class c) { if (c == null) return Collections.EMPTY_SET; Field[] fields = c.getFields(); if (fields == null || fields.length == 0) return Collections.EMPTY_SET; Set<String> result = new TreeSet<String>(); for (Field f : fields) { if (canReflect(f)) result.add(f.getName()); } return result; }
/** * Affirms if the original declaration the given method is annotated * for reflection. */ static boolean canReflect(Method method) { Class cls = getDeclaringClass(method); if (cls != method.getDeclaringClass()) method = getDeclaringMethod(cls, method); return canReflect((Reflectable)cls.getAnnotation(Reflectable.class), method.getAnnotation(Reflectable.class)); }
/** * Affirms if the original declaration the given method is annotated * for reflection. */ static boolean canReflect(Method method) { Class cls = getDeclaringClass(method); if (cls != method.getDeclaringClass()) method = getDeclaringMethod(cls, method); return canReflect((Reflectable)cls.getAnnotation(Reflectable.class), method.getAnnotation(Reflectable.class)); }
/** * Affirms if the original declaration the given method is annotated * for reflection. */ static boolean canReflect(Method method) { Class cls = getDeclaringClass(method); if (cls != method.getDeclaringClass()) method = getDeclaringMethod(cls, method); return canReflect((Reflectable)cls.getAnnotation(Reflectable.class), method.getAnnotation(Reflectable.class)); }
/** * Gets values of all field f the given class such that f exactly * match the given modifiers and are of given type (Object implies any type) * unless f is annotated as {@link Reflectable}. * */ public static <T> Set<T> getFieldValues(Class c, int mods, Class<T> t){ if (c == null) return Collections.EMPTY_SET; Field[] fields = c.getFields(); if (fields == null || fields.length == 0) return Collections.EMPTY_SET; Set<T> result = new TreeSet<T>(); for (Field f : fields) { if (mods == f.getModifiers() && (t == Object.class || t.isAssignableFrom(f.getType())) && canReflect(f)) { try { result.add((T)f.get(null)); } catch (IllegalArgumentException e) { } catch (IllegalAccessException e) { } } } return result; }
/** * Gets values of all field f the given class such that f exactly * match the given modifiers and are of given type (Object implies any type) * unless f is annotated as {@link Reflectable}. * */ public static <T> Set<T> getFieldValues(Class c, int mods, Class<T> t){ if (c == null) return Collections.EMPTY_SET; Field[] fields = c.getFields(); if (fields == null || fields.length == 0) return Collections.EMPTY_SET; Set<T> result = new TreeSet<T>(); for (Field f : fields) { if (mods == f.getModifiers() && (t == Object.class || t.isAssignableFrom(f.getType())) && canReflect(f)) { try { result.add((T)f.get(null)); } catch (IllegalArgumentException e) { } catch (IllegalAccessException e) { } } } return result; }
/** * Affirms if the original declaration the given method is annotated * for reflection. */ static boolean canReflect(Method method) { Class cls = getDeclaringClass(method); if (cls != method.getDeclaringClass()) method = getDeclaringMethod(cls, method); return canReflect((Reflectable)cls.getAnnotation(Reflectable.class), method.getAnnotation(Reflectable.class)); }
/** * Gets values of all field f the given class such that f exactly * match the given modifiers and are of given type (Object implies any type) * unless f is annotated as {@link Reflectable}. * */ public static <T> Set<T> getFieldValues(Class c, int mods, Class<T> t){ if (c == null) return Collections.EMPTY_SET; Field[] fields = c.getFields(); if (fields == null || fields.length == 0) return Collections.EMPTY_SET; Set<T> result = new TreeSet<T>(); for (Field f : fields) { if (mods == f.getModifiers() && (t == Object.class || t.isAssignableFrom(f.getType())) && canReflect(f)) { try { result.add((T)f.get(null)); } catch (IllegalArgumentException e) { } catch (IllegalAccessException e) { } } } return result; }
/** * Gets values of all field f the given class such that f exactly * match the given modifiers and are of given type (Object implies any type) * unless f is annotated as {@link Reflectable}. * */ public static <T> Set<T> getFieldValues(Class c, int mods, Class<T> t){ if (c == null) return Collections.EMPTY_SET; Field[] fields = c.getFields(); if (fields == null || fields.length == 0) return Collections.EMPTY_SET; Set<T> result = new TreeSet<T>(); for (Field f : fields) { if (mods == f.getModifiers() && (t == Object.class || t.isAssignableFrom(f.getType())) && canReflect(f)) { try { result.add((T)f.get(null)); } catch (IllegalArgumentException e) { } catch (IllegalAccessException e) { } } } return result; }
for (Method m : methods) { if (m.getName().startsWith("get")) { if (!canReflect(m)) continue; String prop = StringUtils.capitalize(m.getName()
for (Method m : methods) { if (m.getName().startsWith("get")) { if (!canReflect(m)) continue; String prop = StringUtils.capitalize(m.getName()
for (Method m : methods) { if (m.getName().startsWith("get")) { if (!canReflect(m)) continue; String prop = StringUtil.capitalize(m.getName()
for (Method m : methods) { if (m.getName().startsWith("get")) { if (!canReflect(m)) continue; String prop = StringUtil.capitalize(m.getName()