Author: ggregory
Date: Thu Oct  4 20:06:34 2018
New Revision: 1842848

URL: http://svn.apache.org/viewvc?rev=1842848&view=rev
Log:
[CONFIGURATION-726] Add support for Commons Text 1.5 new string lookups as 
default lookups.

Modified:
    commons/proper/configuration/trunk/src/changes/changes.xml
    
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/DefaultLookups.java

Modified: commons/proper/configuration/trunk/src/changes/changes.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/changes/changes.xml?rev=1842848&r1=1842847&r2=1842848&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/changes/changes.xml (original)
+++ commons/proper/configuration/trunk/src/changes/changes.xml Thu Oct  4 
20:06:34 2018
@@ -69,12 +69,15 @@
       <action dev="ggregory" type="update" issue="CONFIGURATION-723">
         Update optional Spring dependencies from 4.3.18.RELEASE to 
4.3.19.RELEASE.
       </action>
-      <action dev="ggregory" type="update" issue="CONFIGURATION-724">
+      <action dev="ggregory" type="add" issue="CONFIGURATION-724">
         Add support for Commons Text 1.4 localhost string lookup as a default 
lookup.
       </action>
       <action dev="ggregory" type="update" issue="CONFIGURATION-725">
         Update Apache Commons Text from 1.4 to 1.5.
       </action>
+      <action dev="ggregory" type="add" issue="CONFIGURATION-726">
+        Add support for Commons Text 1.5 new string lookups as default lookups.
+      </action>
     </release>
 
     <release version="2.3" date="2018-08-04"

Modified: 
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/DefaultLookups.java
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/DefaultLookups.java?rev=1842848&r1=1842847&r2=1842848&view=diff
==============================================================================
--- 
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/DefaultLookups.java
 (original)
+++ 
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/DefaultLookups.java
 Thu Oct  4 20:06:34 2018
@@ -20,71 +20,180 @@ import org.apache.commons.text.lookup.St
 
 /**
  * <p>
- * An enumeration class defining constants for the {@code Lookup} objects
- * available for each {@code Configuration} object per default.
+ * An enumeration class defining constants for the {@code Lookup} objects 
available for each {@code Configuration}
+ * object per default.
  * </p>
  * <p>
- * When a new configuration object derived from {@code AbstractConfiguration} 
is
- * created it installs a {@link ConfigurationInterpolator} with a default set 
of
- * {@link Lookup} objects. These lookups are defined by this enumeration class.
+ * When a new configuration object derived from {@code AbstractConfiguration} 
is created it installs a
+ * {@link ConfigurationInterpolator} with a default set of {@link Lookup} 
objects. These lookups are defined by this
+ * enumeration class.
  * </p>
  * <p>
- * All the default {@code Lookup} classes are state-less, thus their instances
- * can be shared between multiple configuration objects. Therefore, it makes
- * sense to keep shared instances in this enumeration class.
+ * All the default {@code Lookup} classes are state-less, thus their instances 
can be shared between multiple
+ * configuration objects. Therefore, it makes sense to keep shared instances 
in this enumeration class.
  * </p>
- *
+ * 
+ * Provides access to lookups defined in Apache Commons Text:
+ * <ul>
+ * <li>"base64" for the {@code Base64StringLookup} since Apache Commons Text 
1.5.</li>
+ * <li>"const" for the {@code ConstantStringLookup} since Apache Commons Text 
1.5.</li>
+ * <li>"date" for the {@code DateStringLookup}.</li>
+ * <li>"env" for the {@code EnvironmentVariableStringLookup}.</li>
+ * <li>"file" for the {@code FileStringLookup} since Apache Commons Text 
1.5.</li>
+ * <li>"java" for the {@code JavaPlatformStringLookup}.</li>
+ * <li>"localhost" for the {@code LocalHostStringLookup}, see {@code 
#localHostStringLookup()} for key names; since
+ * Apache Commons Text 1.3.</li>
+ * <li>"properties" for the {@code PropertiesStringLookup} since Apache 
Commons Text 1.5.</li>
+ * <li>"resourceBundle" for the {@code ResourceBundleStringLookup} since 
Apache Commons Text 1.5.</li>
+ * <li>"script" for the {@code ScriptStringLookup} since Apache Commons Text 
1.5.</li>
+ * <li>"sys" for the {@code SystemPropertyStringLookup}.</li>
+ * <li>"url" for the {@code UrlStringLookup} since Apache Commons Text 
1.5.</li>
+// * <li>"urlDecode" for the {@code UrlDecoderStringLookup} since Apache 
Commons Text 1.6.</li>
+// * <li>"urlEncode" for the {@code UrlEncoderStringLookup} since Apache 
Commons Text 1.6.</li>
+ * <li>"xml" for the {@code XmlStringLookup} since Apache Commons Text 
1.5.</li>
+ * </ul>
+ * 
  * @version $Id$
  * @since 2.0
  */
-public enum DefaultLookups
-{
-    /** @since 2.4 */
+public enum DefaultLookups {
+
+    /**
+     * The lookup for Base64.
+     * 
+     * @since 2.4
+     */
+    BASE64("base64", new 
StringLookupAdapter(StringLookupFactory.INSTANCE.base64StringLookup())),
+
+    /**
+     * The lookup for constants.
+     * 
+     * @since 2.4
+     */
+    CONST("const", new 
StringLookupAdapter(StringLookupFactory.INSTANCE.constantStringLookup())),
+
+    /**
+     * The lookup for dates.
+     * 
+     * @since 2.4
+     */
+    DATE("date", new 
StringLookupAdapter(StringLookupFactory.INSTANCE.dateStringLookup())),
+
+    /**
+     * The lookup for environment properties.
+     */
+    ENVIRONMENT("env", new 
StringLookupAdapter(StringLookupFactory.INSTANCE.environmentVariableStringLookup())),
+
+    /**
+     * The lookup for files.
+     * 
+     * @since 2.4
+     */
+    FILE("file", new 
StringLookupAdapter(StringLookupFactory.INSTANCE.fileStringLookup())),
+
+    /**
+     * The lookup for Java platform information.
+     * 
+     * @since 2.4
+     */
+    JAVA("java", new 
StringLookupAdapter(StringLookupFactory.INSTANCE.javaPlatformStringLookup())),
+
+    /**
+     * The lookup for localhost information.
+     * 
+     * @since 2.4
+     */
     LOCAL_HOST("localhost", new 
StringLookupAdapter(StringLookupFactory.INSTANCE.localHostStringLookup())),
-    
-    /** The lookup for system properties. */
-    SYSTEM_PROPERTIES("sys", new SystemPropertiesLookup()),
 
-    /** The lookup for environment properties. */
-    ENVIRONMENT("env", new EnvironmentLookup()),
+    /**
+     * The lookup for properties.
+     * 
+     * @since 2.4
+     */
+    PROPERTIES("properties", new 
StringLookupAdapter(StringLookupFactory.INSTANCE.propertiesStringLookup())),
+
+    /**
+     * The lookup for resource bundles.
+     * 
+     * @since 2.4
+     */
+    RESOURCE_BUNDLE("resourceBundle",
+            new 
StringLookupAdapter(StringLookupFactory.INSTANCE.resourceBundleStringLookup())),
 
-    /** The lookup for constants. */
-    CONST("const", new ConstantLookup());
+    /**
+     * The lookup for scripts.
+     * 
+     * @since 2.4
+     */
+    SCRIPT("script", new 
StringLookupAdapter(StringLookupFactory.INSTANCE.scriptStringLookup())),
 
-    /** The prefix under which the associated lookup object is registered. */
-    private final String prefix;
+    /**
+     * The lookup for system properties.
+     */
+    SYSTEM_PROPERTIES("sys", new 
StringLookupAdapter(StringLookupFactory.INSTANCE.systemPropertyStringLookup())),
+
+    /**
+     * The lookup for URLs.
+     * 
+     * @since 2.4
+     */
+    URL("url", new 
StringLookupAdapter(StringLookupFactory.INSTANCE.urlStringLookup())),
+
+    /**
+     * The lookup for URL decoding.
+     * 
+     * @since 2.4
+     */
+    // URL_DECODE("urlDecode", new 
StringLookupAdapter(StringLookupFactory.INSTANCE.urlDecodeStringLookup())),
+
+    /**
+     * The lookup for URL decoding.
+     * 
+     * @since 2.4
+     */
+    // URL_ENCODE("urlEncode", new 
StringLookupAdapter(StringLookupFactory.INSTANCE.urlEncodeStringLookup())),
+
+    /**
+     * The lookup for URL decoding.
+     * 
+     * @since 2.4
+     */
+    XML("xml", new 
StringLookupAdapter(StringLookupFactory.INSTANCE.xmlStringLookup()));
 
     /** The associated lookup instance. */
     private final Lookup lookup;
 
+    /** The prefix under which the associated lookup object is registered. */
+    private final String prefix;
+
     /**
-     * Creates a new instance of {@code DefaultLookups} and sets the prefix and
-     * the associated lookup instance.
+     * Creates a new instance of {@code DefaultLookups} and sets the prefix 
and the associated lookup instance.
      *
-     * @param prefix the prefix
-     * @param lookup the {@code Lookup} instance
+     * @param prefix
+     *            the prefix
+     * @param lookup
+     *            the {@code Lookup} instance
      */
-    private DefaultLookups(final String prefix, final Lookup lookup)
-    {
+    private DefaultLookups(final String prefix, final Lookup lookup) {
         this.prefix = prefix;
         this.lookup = lookup;
     }
 
     /**
-     * Returns the standard prefix for the lookup object of this kind.
+     * Returns the standard {@code Lookup} instance of this kind.
      *
-     * @return the prefix
+     * @return the associated {@code Lookup} object
      */
-    public String getPrefix() {
-        return prefix;
+    public Lookup getLookup() {
+        return lookup;
     }
 
     /**
-     * Returns the standard {@code Lookup} instance of this kind.
+     * Returns the standard prefix for the lookup object of this kind.
      *
-     * @return the associated {@code Lookup} object
+     * @return the prefix
      */
-    public Lookup getLookup() {
-        return lookup;
+    public String getPrefix() {
+        return prefix;
     }
 }


Reply via email to