commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r890360 - /commons/proper/lang/trunk/src/java/org/apache/commons/lang3/text/StrLookup.java
Date Mon, 14 Dec 2009 15:06:15 GMT
Author: sebb
Date: Mon Dec 14 15:06:14 2009
New Revision: 890360

URL: http://svn.apache.org/viewvc?rev=890360&view=rev
Log:
Fix up some raw types.
May need to adjust some types if lookup() is made generic (see LANG-564)

Modified:
    commons/proper/lang/trunk/src/java/org/apache/commons/lang3/text/StrLookup.java

Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang3/text/StrLookup.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang3/text/StrLookup.java?rev=890360&r1=890359&r2=890360&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang3/text/StrLookup.java (original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang3/text/StrLookup.java Mon Dec
14 15:06:14 2009
@@ -40,16 +40,19 @@
     /**
      * Lookup that always returns null.
      */
-    private static final StrLookup<?> NONE_LOOKUP;
+    private static final StrLookup<String> NONE_LOOKUP;
     /**
      * Lookup that uses System properties.
      */
-    private static final StrLookup<Object> SYSTEM_PROPERTIES_LOOKUP;
+    private static final StrLookup<String> SYSTEM_PROPERTIES_LOOKUP;
     static {
-        NONE_LOOKUP = new MapStrLookup(null);
-        StrLookup lookup = null;
+        NONE_LOOKUP = new MapStrLookup<String>(null);
+        StrLookup<String> lookup = null;
         try {
-            lookup = new MapStrLookup(System.getProperties());
+            final Map<?, ?> propMap = System.getProperties();
+            @SuppressWarnings("unchecked") // System property keys and values are always
Strings
+            final Map<String, String> properties = (Map<String, String>) propMap;
+            lookup = new MapStrLookup<String>(properties);
         } catch (SecurityException ex) {
             lookup = NONE_LOOKUP;
         }
@@ -77,7 +80,7 @@
      *
      * @return a lookup using system properties, not null
      */
-    public static StrLookup<Object> systemPropertiesLookup() {
+    public static StrLookup<String> systemPropertiesLookup() {
         return SYSTEM_PROPERTIES_LOOKUP;
     }
 
@@ -90,7 +93,7 @@
      * @param map  the map of keys to values, may be null
      * @return a lookup using the map, not null
      */
-    public static <V> StrLookup mapLookup(Map<String, V> map) {
+    public static <V> StrLookup<V> mapLookup(Map<String, V> map) {
         return new MapStrLookup<V>(map);
     }
 
@@ -124,7 +127,7 @@
     /**
      * Lookup implementation that uses a Map.
      */
-    static class MapStrLookup<V> extends StrLookup {
+    static class MapStrLookup<V> extends StrLookup<V> {
 
         /** Map keys are variable names and value. */
         private final Map<String, V> map;



Mime
View raw message