Commit e55c4edabac1391e5a0e33b416a19b4c1c034a56
1 parent
9e9ec64d
Exists in
master
Considerando métodos da classe pai
Showing
1 changed file
with
15 additions
and
1 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/configuration/ConfigurationLoader.java
@@ -43,8 +43,11 @@ import java.lang.reflect.Method; | @@ -43,8 +43,11 @@ import java.lang.reflect.Method; | ||
43 | import java.lang.reflect.ParameterizedType; | 43 | import java.lang.reflect.ParameterizedType; |
44 | import java.lang.reflect.Type; | 44 | import java.lang.reflect.Type; |
45 | import java.net.URL; | 45 | import java.net.URL; |
46 | +import java.util.ArrayList; | ||
47 | +import java.util.Arrays; | ||
46 | import java.util.HashSet; | 48 | import java.util.HashSet; |
47 | import java.util.Iterator; | 49 | import java.util.Iterator; |
50 | +import java.util.List; | ||
48 | import java.util.Properties; | 51 | import java.util.Properties; |
49 | import java.util.Set; | 52 | import java.util.Set; |
50 | 53 | ||
@@ -102,11 +105,22 @@ public class ConfigurationLoader implements Serializable { | @@ -102,11 +105,22 @@ public class ConfigurationLoader implements Serializable { | ||
102 | 105 | ||
103 | getLogger().debug(getBundle().getString("loading-configuration-class", config.getName())); | 106 | getLogger().debug(getBundle().getString("loading-configuration-class", config.getName())); |
104 | 107 | ||
105 | - for (Field field : Reflections.getNonStaticDeclaredFields(config)) { | 108 | + for (Field field : getNonStaticFields(config)) { |
106 | loadField(field, object, config); | 109 | loadField(field, object, config); |
107 | } | 110 | } |
108 | } | 111 | } |
109 | 112 | ||
113 | + private List<Field> getNonStaticFields(Class<?> type) { | ||
114 | + List<Field> fields = new ArrayList<Field>(); | ||
115 | + | ||
116 | + if (type != null) { | ||
117 | + fields.addAll(Arrays.asList(Reflections.getNonStaticDeclaredFields(type))); | ||
118 | + fields.addAll(getNonStaticFields(type.getSuperclass())); | ||
119 | + } | ||
120 | + | ||
121 | + return fields; | ||
122 | + } | ||
123 | + | ||
110 | private void loadField(Field field, Object object, Class<?> clazz) { | 124 | private void loadField(Field field, Object object, Class<?> clazz) { |
111 | if (!field.isAnnotationPresent(Ignore.class) && clazz.isAnnotationPresent(Configuration.class)) { | 125 | if (!field.isAnnotationPresent(Ignore.class) && clazz.isAnnotationPresent(Configuration.class)) { |
112 | String resource = clazz.getAnnotation(Configuration.class).resource(); | 126 | String resource = clazz.getAnnotation(Configuration.class).resource(); |