Commit 38e4750e43da8a3946e8cc8f46e7438a8b8cf8e2
1 parent
e3778be8
Remove javadocs
Showing
6 changed files
with
2 additions
and
171 deletions
Show diff stats
demoiselle-configuration/src/main/java/org/demoiselle/jee/configuration/ConfigType.java
1 | 1 | package org.demoiselle.jee.configuration; |
2 | 2 | |
3 | -/** | |
4 | - * Defines configuration types to be loaded. | |
5 | - * | |
6 | - * @author SERPRO | |
7 | - */ | |
8 | 3 | public enum ConfigType { |
9 | - | |
10 | - /** | |
11 | - * Configuration loaded on {@link System#getProperties()} or {@link System#getenv()}. | |
12 | - */ | |
13 | 4 | SYSTEM, |
14 | - | |
15 | - /** | |
16 | - * Configuration loaded on XML resources. | |
17 | - */ | |
18 | 5 | XML, |
19 | - | |
20 | - /** | |
21 | - * Configuration loaded on properties resources. | |
22 | - */ | |
23 | 6 | PROPERTIES |
24 | - | |
25 | 7 | } | ... | ... |
demoiselle-configuration/src/main/java/org/demoiselle/jee/configuration/ConfigurationException.java
... | ... | @@ -2,33 +2,14 @@ package org.demoiselle.jee.configuration; |
2 | 2 | |
3 | 3 | import org.demoiselle.jee.core.exception.DemoiselleException; |
4 | 4 | |
5 | -/** | |
6 | - * Exception class intended to be used by configuration components. | |
7 | - * | |
8 | - * @author SERPRO | |
9 | - */ | |
10 | 5 | public class ConfigurationException extends DemoiselleException{ |
11 | 6 | |
12 | 7 | private static final long serialVersionUID = 1L; |
13 | 8 | |
14 | - /** | |
15 | - * Constructor with message. | |
16 | - * | |
17 | - * @param message | |
18 | - * exception message | |
19 | - */ | |
20 | 9 | public ConfigurationException(String message) { |
21 | 10 | super(message); |
22 | 11 | } |
23 | - | |
24 | - /** | |
25 | - * Constructor with message and cause. | |
26 | - * | |
27 | - * @param message | |
28 | - * exception message | |
29 | - * @param cause | |
30 | - * exception cause | |
31 | - */ | |
12 | + | |
32 | 13 | public ConfigurationException(String message, Throwable cause) { |
33 | 14 | super(message, cause); |
34 | 15 | } | ... | ... |
demoiselle-configuration/src/main/java/org/demoiselle/jee/configuration/ConfigurationInterceptor.java
... | ... | @@ -9,12 +9,6 @@ import javax.interceptor.InvocationContext; |
9 | 9 | |
10 | 10 | import org.demoiselle.jee.configuration.annotation.Configuration; |
11 | 11 | |
12 | -/** | |
13 | - * <p> | |
14 | - * Interceptor class that loads the values of configuration files | |
15 | - * into it's mapped class. | |
16 | - * </p> | |
17 | - */ | |
18 | 12 | @Dependent |
19 | 13 | @Configuration |
20 | 14 | @Interceptor | ... | ... |
demoiselle-configuration/src/main/java/org/demoiselle/jee/configuration/ConfigurationLoader.java
... | ... | @@ -43,13 +43,6 @@ import org.demoiselle.jee.core.annotation.Ignore; |
43 | 43 | import org.demoiselle.jee.core.annotation.Name; |
44 | 44 | import org.demoiselle.jee.core.annotation.Priority; |
45 | 45 | |
46 | -/** | |
47 | - * This component loads a config class annotated with {@link org.demoiselle.jee.configuration.annotation.configuration.Configuration} | |
48 | - * by filling its attributes with {@link org.demoiselle.jsf.util.Parameter} | |
49 | - * according to a {@link org.demoiselle.configuration.ConfigType}. | |
50 | - * | |
51 | - * @author SERPRO | |
52 | - */ | |
53 | 46 | @ApplicationScoped |
54 | 47 | public class ConfigurationLoader implements Serializable { |
55 | 48 | |
... | ... | @@ -316,14 +309,7 @@ public class ConfigurationLoader implements Serializable { |
316 | 309 | throw new ConfigurationException(message.toString(), new ConstraintViolationException(violations)); |
317 | 310 | } |
318 | 311 | } |
319 | - | |
320 | - | |
321 | - | |
322 | 312 | |
323 | - /** | |
324 | - * @param type Base type to look for fields | |
325 | - * @return All non static fields from a certain type, including fields declared in superclasses of this type. | |
326 | - */ | |
327 | 313 | public List<Field> getNonStaticFields(Class<?> type) { |
328 | 314 | List<Field> fields = new ArrayList<Field>(); |
329 | 315 | |
... | ... | @@ -338,11 +324,6 @@ public class ConfigurationLoader implements Serializable { |
338 | 324 | return fields; |
339 | 325 | } |
340 | 326 | |
341 | - /** | |
342 | - * @param type Base type to look for fields | |
343 | - * @return All non static fields from a certain type. Inherited fields are not returned, so if you need to get | |
344 | - * inherited fields you must iterate over this type's hierarchy. | |
345 | - */ | |
346 | 327 | public Field[] getNonStaticDeclaredFields(Class<?> type) { |
347 | 328 | List<Field> fields = new ArrayList<Field>(); |
348 | 329 | |
... | ... | @@ -357,23 +338,11 @@ public class ConfigurationLoader implements Serializable { |
357 | 338 | return fields.toArray(new Field[0]); |
358 | 339 | } |
359 | 340 | |
360 | - /** | |
361 | - * Return an URL to access a resource available to the active classloader for the calling thread. | |
362 | - * | |
363 | - * @param resource String representation of the location of the resource on the classpath | |
364 | - * @return The {@link URL} for the resource | |
365 | - */ | |
366 | 341 | public URL getResourceAsURL(final String resource) { |
367 | 342 | ClassLoader classLoader = getClassLoaderForResource(resource); |
368 | 343 | return classLoader != null ? classLoader.getResource(resource) : null; |
369 | 344 | } |
370 | - | |
371 | - /** | |
372 | - * Obtains the {@link ClassLoader} for the given resource. | |
373 | - * | |
374 | - * @param resource String representation of the fully qualified path to the resource on the classpath | |
375 | - * @return {@link ClassLoader} ClassLoader for the given resource. | |
376 | - */ | |
345 | + | |
377 | 346 | public ClassLoader getClassLoaderForResource(final String resource) { |
378 | 347 | final String stripped = resource.charAt(0) == '/' ? resource.substring(1) : resource; |
379 | 348 | |
... | ... | @@ -413,13 +382,6 @@ public class ConfigurationLoader implements Serializable { |
413 | 382 | return result; |
414 | 383 | } |
415 | 384 | |
416 | - /** | |
417 | - * Sets a value in a field. | |
418 | - * | |
419 | - * @param field field to be setted. | |
420 | - * @param object object that contains the field. | |
421 | - * @param value value to be setted in the field. | |
422 | - */ | |
423 | 385 | public void setFieldValue(Field field, Object object, Object value) { |
424 | 386 | try { |
425 | 387 | boolean acessible = field.isAccessible(); | ... | ... |
demoiselle-configuration/src/main/java/org/demoiselle/jee/configuration/annotation/Configuration.java
... | ... | @@ -14,24 +14,6 @@ import java.lang.annotation.Target; |
14 | 14 | import static java.lang.annotation.ElementType.TYPE; |
15 | 15 | import static java.lang.annotation.RetentionPolicy.RUNTIME; |
16 | 16 | |
17 | -/** | |
18 | - * <p> | |
19 | - * Identifies a <b>configuration class</b>, that is, a structure reserved to store configuration values retrieved from a | |
20 | - * given resource file or system variables. | |
21 | - * </p> | |
22 | - * <p> | |
23 | - * Configuration resources are application scoped, meaning only one instance can ever exist in | |
24 | - * a running application. For that reason usually configuration fields are immutable, to avoid | |
25 | - * changes made in one context affecting other contexts in a running application. | |
26 | - * </p> | |
27 | - * <p>A <i>Configuration</i> is:</p> | |
28 | - * <ul> | |
29 | - * <li>defined when annotated with {@code @Configuration}</li> | |
30 | - * <li>automatically injected whenever {@code @Inject} is used</li> | |
31 | - * </ul> | |
32 | - * | |
33 | - * @author SERPRO | |
34 | - */ | |
35 | 17 | @ApplicationScoped |
36 | 18 | @Named |
37 | 19 | @InterceptorBinding |
... | ... | @@ -40,43 +22,14 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; |
40 | 22 | @Retention(RUNTIME) |
41 | 23 | public @interface Configuration { |
42 | 24 | |
43 | - /** | |
44 | - * Define the default prefix. | |
45 | - */ | |
46 | 25 | String DEFAULT_PREFIX = "demoiselle"; |
47 | 26 | |
48 | - /** | |
49 | - * Define the default resource. | |
50 | - */ | |
51 | 27 | String DEFAULT_RESOURCE = "demoiselle"; |
52 | 28 | |
53 | - /** | |
54 | - * Defines the resource type to be used: a properties file, an XML file, or system variables. | |
55 | - * If not specified, a properties resource file is to be considered. | |
56 | - * | |
57 | - * @return ConfigType Type of configuration resource file to look for | |
58 | - */ | |
59 | 29 | @Nonbinding ConfigType type() default ConfigType.PROPERTIES; |
60 | 30 | |
61 | - /** | |
62 | - * Defines an optional prefix to be used on every parameter key. | |
63 | - * For instance, if prefix is set to <code>"demoiselle.pagination"</code> and an attribute named | |
64 | - * <code>defaultPageSize</code> is found in the class, the corresponding key | |
65 | - * <code>demoiselle.pagination.defaultPageSize</code> is expected to be read in the resource file. | |
66 | - * | |
67 | - * @return String prefix common to all attributes to be read by the configuration class | |
68 | - */ | |
69 | 31 | @Nonbinding String prefix() default DEFAULT_PREFIX; |
70 | 32 | |
71 | - /** | |
72 | - * Defines the resource file name to be read by this configuration class. There is no need to specify file extension | |
73 | - * in the case of properties or XML resources. | |
74 | - * For instance, when resource is set to <code>"bookmark"</code> and the type set to properties, a corresponding | |
75 | - * file named <code>bookmark.properties</code> is considered. | |
76 | - * If not specified, the default configuration file <code>demoiselle.properties</code> is used instead. | |
77 | - * | |
78 | - * @return String Name of the resource file to look for (minus file extension) | |
79 | - */ | |
80 | 33 | @Nonbinding String resource() default DEFAULT_RESOURCE; |
81 | 34 | |
82 | 35 | } | ... | ... |
demoiselle-configuration/src/main/java/org/demoiselle/jee/configuration/extractor/ConfigurationValueExtractor.java
... | ... | @@ -4,48 +4,7 @@ import java.lang.reflect.Field; |
4 | 4 | |
5 | 5 | import org.apache.commons.configuration2.Configuration; |
6 | 6 | |
7 | -/** | |
8 | - * <p> | |
9 | - * Interface that defines how to convert values extracted from configuration | |
10 | - * files to fields in a class annotated with {@link Configuration}. | |
11 | - * </p> | |
12 | - * | |
13 | - * <p> | |
14 | - * Primitive types like <code>int</code> and <code>float</code>, their wrapper | |
15 | - * counterparts like {@link Integer} and {@link Float} and the {@link String} class | |
16 | - * can already be converted by the framework, this interface is reserved for specialized | |
17 | - * classes. | |
18 | - * </p> | |
19 | - * | |
20 | - * @author SERPRO | |
21 | - */ | |
22 | 7 | public interface ConfigurationValueExtractor { |
23 | - | |
24 | - /** | |
25 | - * Method that must appropriately extract the value from a property file and set this value to a | |
26 | - * field in a configuration class. | |
27 | - * | |
28 | - * @param prefix | |
29 | - * optional parte of property name that must be concatenated with <b>key</b> to form the whole | |
30 | - * property name. | |
31 | - * @param key | |
32 | - * key of the property. | |
33 | - * @param field | |
34 | - * configuration field to be setted. | |
35 | - * @param configuration | |
36 | - * a configuration object. | |
37 | - * @return current value of this property | |
38 | - * @throws Exception if the value can't be extracted from the property file | |
39 | - */ | |
40 | 8 | Object getValue(String prefix, String key, Field field, Configuration configuration) throws Exception; |
41 | - | |
42 | - /** | |
43 | - * Checks if the extractor class is appropriate to extract values to the type of deffined by parameter | |
44 | - * <b>field</b>. | |
45 | - * | |
46 | - * @param field | |
47 | - * field to be checked. | |
48 | - * @return <code>true</code> if this extractor can convert this field into the extractor's final type | |
49 | - */ | |
50 | 9 | boolean isSupported(Field field); |
51 | 10 | } | ... | ... |