View Javadoc
1   package org.fax4j.common;
2   
3   import java.util.Map;
4   
5   /**
6    * Common interface for configuration holder components.
7    *
8    * @author Sagie Gur-Ari
9    * @version 1.01
10   * @since 0.41.7
11   */
12  public interface ConfigurationHolder {
13      /**
14       * Returns the property part.<br>
15       * Property parts enables to replace the input request key with the part defined to enable to reuse services with
16       * different configuration blocks.<br>
17       * Property parts will be replaced with the {0} values in the key, for example org.fax4j.{0}.somekey with part abc
18       * will be replaced to org.fax4j.abc.somekey
19       *
20       * @return The property part
21       */
22      String getPropertyPart();
23  
24      /**
25       * Returns the configuration.
26       *
27       * @return The configuration
28       */
29      Map<String, String> getConfiguration();
30  
31      /**
32       * Returns the value from the component configuration based on the provided configuration key. The value will be
33       * trimmed.<br>
34       * If the trimmed configuration value is an empty string, null will be returned instead.
35       *
36       * @param key
37       *            The configuration key
38       * @return The value
39       */
40      String getConfigurationValue(String key);
41  
42      /**
43       * Returns the value from the component configuration based on the provided configuration key. The value will be
44       * trimmed.<br>
45       * If the trimmed configuration value is an empty string, null will be returned instead.
46       *
47       * @param key
48       *            The configuration key (toString value will be used)
49       * @return The value
50       */
51      String getConfigurationValue(Enum<?> key);
52  }