Commit b8adab8972061daba9e31027b39ebc7890fc2439

Authored by Wilson Guimarães
2 parents 9d773bb1 41bc7ad0
Exists in master

Merge branch 'master' of git@github.com:demoiselle/framework.git

impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/configuration/ConfigurationLoader.java
@@ -108,7 +108,6 @@ public class ConfigurationLoader { @@ -108,7 +108,6 @@ public class ConfigurationLoader {
108 org.apache.commons.configuration.Configuration config = getConfiguration(resource, type); 108 org.apache.commons.configuration.Configuration config = getConfiguration(resource, type);
109 109
110 String key = getKey(field, clazz, config); 110 String key = getKey(field, clazz, config);
111 - //Object value = getValue(key, field.getType(), config);  
112 Object value = getValue(key, field, config); 111 Object value = getValue(key, field, config);
113 112
114 validate(field, key, value, resource); 113 validate(field, key, value, resource);
@@ -235,31 +234,6 @@ public class ConfigurationLoader { @@ -235,31 +234,6 @@ public class ConfigurationLoader {
235 return config; 234 return config;
236 } 235 }
237 236
238 - /**  
239 - * Returns the value associated with the given configuration class and field type.  
240 - *  
241 - * @param name  
242 - * @param config  
243 - * @param fieldClass  
244 - * @return the value  
245 - */  
246 - /*@SuppressWarnings("unchecked")  
247 - private <T> T getValue(String key, Class<T> fieldClass, org.apache.commons.configuration.Configuration config) {  
248 - Object value;  
249 -  
250 - if (fieldClass.isArray() && fieldClass.getComponentType().equals(String.class)) {  
251 - value = config.getStringArray(key);  
252 -  
253 - } else if (fieldClass.equals(Properties.class)) {  
254 - value = getProperty(key, config);  
255 -  
256 - } else {  
257 - value = getBasic(key, fieldClass, config);  
258 - }  
259 -  
260 - return (T) value;  
261 - }*/  
262 -  
263 @SuppressWarnings("unchecked") 237 @SuppressWarnings("unchecked")
264 private <T> T getValue(String key, Field field, org.apache.commons.configuration.Configuration config) { 238 private <T> T getValue(String key, Field field, org.apache.commons.configuration.Configuration config) {
265 Object value; 239 Object value;
@@ -278,29 +252,6 @@ public class ConfigurationLoader { @@ -278,29 +252,6 @@ public class ConfigurationLoader {
278 return (T) value; 252 return (T) value;
279 } 253 }
280 254
281 - /*private <T> Object getBasic(String key, Class<T> fieldClass, org.apache.commons.configuration.Configuration config) {  
282 - Object value = null;  
283 -  
284 - try {  
285 - Method method;  
286 - String methodName = "get" + Strings.firstToUpper(fieldClass.getSimpleName());  
287 -  
288 - if (!fieldClass.isPrimitive()) {  
289 - method = config.getClass().getMethod(methodName, String.class, fieldClass);  
290 - value = method.invoke(config, key, null);  
291 -  
292 - } else if (config.containsKey(key)) {  
293 - method = config.getClass().getMethod(methodName, String.class);  
294 - value = method.invoke(config, key);  
295 - }  
296 -  
297 - } catch (Throwable cause) {  
298 - throw new ConfigurationException(bundle.getString("error-converting-to-type", fieldClass.getName()), cause);  
299 - }  
300 -  
301 - return value;  
302 - }*/  
303 -  
304 private <T> Object getArray(String key, Field field, org.apache.commons.configuration.Configuration config) { 255 private <T> Object getArray(String key, Field field, org.apache.commons.configuration.Configuration config) {
305 Object value = null; 256 Object value = null;
306 257