Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Map<String, Human> getBeans(List<Method> methods) throws Exception {
- Map<String, Human> ans = new HashMap<>();
- if (methods.isEmpty()) return ans;
- for (Method i : methods) {
- String annotation = i.getAnnotation(Annot.class).value();
- if (annotation.isEmpty()) {
- ans.put(i.getName(), (Human) i.invoke(null, ans.get(annotation)));
- }
- }
- for (int i = 0; i < methods.size() - 1; i++) {
- for (int j = i; j < methods.size(); j++) {
- String annotation = methods.get(j).getAnnotation(Annot.class).value();
- if(ans.containsKey(methods.get(j).getName())) continue;
- if (!annotation.isEmpty() && ans.containsKey(annotation) ){
- ans.put(methods.get(j).getName(),
- (Human) methods.get(j).invoke(null, ans.get(annotation)));
- }
- }
- }
- return ans;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement