for (Field f : fieldsWithAnnotation(cls)) { f.setAccessible(true); if (needsRecursion(f)) { if (fieldVal != null) { IgniteBiTuple<Object, Boolean> tup = annotatedValue(fieldVal, visited, annFound); for (Method m : methodsWithAnnotation(cls)) { if (annFound) throw new IgniteCheckedException("Multiple annotations has been found [cls=" + cls.getName() +
/** * Returns annotated value. * * @param target Object to find a value in. * @return Value of annotated field or method. * @throws IgniteCheckedException If failed to find. */ public Object annotatedValue(Object target) throws IgniteCheckedException { IgniteBiTuple<Object, Boolean> res = annotatedValue(target, new HashSet<>(), false); assert res != null; return res.get1(); }
/** * Gets all entries from the specified class or its super-classes that have * been annotated with annotation provided. * * @param cls Class in which search for fields. * @return Set of entries with given annotations. */ private Iterable<Field> fieldsWithAnnotation(Class<?> cls) { synchronized (mux) { List<Field> fields = fieldCache.get(cls); if (fields == null) { fields = new ArrayList<>(); for (Field field : cls.getDeclaredFields()) { Annotation ann = field.getAnnotation(annCls); if (ann != null || needsRecursion(field)) fields.add(field); } if (!fields.isEmpty()) fieldCache.put(cls, fields); } return fields; } }
/** * Returns annotated value. * * @param target Object to find a value in. * @return Value of annotated field or method. * @throws IgniteCheckedException If failed to find. */ public Object annotatedValue(Object target) throws IgniteCheckedException { IgniteBiTuple<Object, Boolean> res = annotatedValue(target, new HashSet<>(), false); assert res != null; return res.get1(); }
/** * Gets all entries from the specified class or its super-classes that have * been annotated with annotation provided. * * @param cls Class in which search for fields. * @return Set of entries with given annotations. */ private Iterable<Field> fieldsWithAnnotation(Class<?> cls) { synchronized (mux) { List<Field> fields = fieldCache.get(cls); if (fields == null) { fields = new ArrayList<>(); for (Field field : cls.getDeclaredFields()) { Annotation ann = field.getAnnotation(annCls); if (ann != null || needsRecursion(field)) fields.add(field); } if (!fields.isEmpty()) fieldCache.put(cls, fields); } return fields; } }
for (Field f : fieldsWithAnnotation(cls)) { f.setAccessible(true); if (needsRecursion(f)) { if (fieldVal != null) { IgniteBiTuple<Object, Boolean> tup = annotatedValue(fieldVal, visited, annFound); for (Method m : methodsWithAnnotation(cls)) { if (annFound) throw new IgniteCheckedException("Multiple annotations has been found [cls=" + cls.getName() +