directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r679217 - /directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/util/PreferencesDictionary.java
Date Wed, 23 Jul 2008 22:41:11 GMT
Author: akarasulu
Date: Wed Jul 23 15:41:10 2008
New Revision: 679217

URL: http://svn.apache.org/viewvc?rev=679217&view=rev
Log:
cleaning up preferences dictionary and generics

Modified:
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/util/PreferencesDictionary.java

Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/util/PreferencesDictionary.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/util/PreferencesDictionary.java?rev=679217&r1=679216&r2=679217&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/util/PreferencesDictionary.java
(original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/util/PreferencesDictionary.java
Wed Jul 23 15:41:10 2008
@@ -32,7 +32,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class PreferencesDictionary extends Dictionary
+public class PreferencesDictionary extends Dictionary<String,String>
 {
     /** the underlying wrapped preferences object */
     private final Preferences prefs;
@@ -93,13 +93,14 @@
     }
 
 
-    public Enumeration elements()
+    @SuppressWarnings("unchecked")
+    public Enumeration<String> elements()
     {
         try
         {
             return new ArrayEnumeration( prefs.keys() )
             {
-                public Object nextElement()
+                public String nextElement()
                 {
                     String key = ( String ) super.nextElement();
 
@@ -114,7 +115,8 @@
     }
 
 
-    public Enumeration keys()
+    @SuppressWarnings("unchecked")
+    public Enumeration<String> keys()
     {
         try
         {
@@ -127,7 +129,7 @@
     }
 
 
-    public Object get( Object key )
+    public String get( Object key )
     {
         if ( key instanceof String )
         {
@@ -138,9 +140,9 @@
     }
 
 
-    public Object remove( Object key )
+    public String remove( Object key )
     {
-        Object retval = get( key );
+        String retval = get( key );
 
         if ( key instanceof String )
         {
@@ -155,33 +157,11 @@
     }
 
 
-    public Object put( Object key, Object value )
+    public String put( String key, String value )
     {
-        Object retval = get( key );
+        String retval = get( key );
 
-        String skey = null;
-
-        String svalue = null;
-
-        if ( key instanceof String )
-        {
-            skey = ( String ) key;
-        }
-        else
-        {
-            skey = key.toString();
-        }
-
-        if ( value instanceof String )
-        {
-            svalue = ( String ) value;
-        }
-        else
-        {
-            svalue = value.toString();
-        }
-
-        prefs.put( skey, svalue );
+        prefs.put( key, value );
 
         return retval;
     }



Mime
View raw message