Author: trustin
Date: Sat Sep 29 14:49:33 2007
New Revision: 580650

URL: http://svn.apache.org/viewvc?rev=580650&view=rev
Log:
Resolved issue: DIRMINA-448 (Allow Object keys for session attributes)
* Trivial changes in session attribute access methods

Modified:
    mina/trunk/core/src/main/java/org/apache/mina/common/AbstractIoSession.java
    mina/trunk/core/src/main/java/org/apache/mina/common/IoSession.java

Modified: 
mina/trunk/core/src/main/java/org/apache/mina/common/AbstractIoSession.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/common/AbstractIoSession.java?rev=580650&r1=580649&r2=580650&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/common/AbstractIoSession.java 
(original)
+++ mina/trunk/core/src/main/java/org/apache/mina/common/AbstractIoSession.java 
Sat Sep 29 14:49:33 2007
@@ -55,8 +55,8 @@
 
     private final Object lock = new Object();
 
-    private final Map<String, Object> attributes = Collections
-            .synchronizedMap(new HashMap<String, Object>(4));
+    private final Map<Object, Object> attributes = Collections
+            .synchronizedMap(new HashMap<Object, Object>(4));
 
     private final Queue<WriteRequest> writeRequestQueue =
         new ConcurrentLinkedQueue<WriteRequest>();
@@ -219,7 +219,7 @@
         return setAttribute("", attachment);
     }
 
-    public Object getAttribute(String key) {
+    public Object getAttribute(Object key) {
         if (key == null) {
             throw new NullPointerException("key");
         }
@@ -227,7 +227,7 @@
         return attributes.get(key);
     }
 
-    public Object getAttribute(String key, Object defaultValue) {
+    public Object getAttribute(Object key, Object defaultValue) {
         if (key == null) {
             throw new NullPointerException("key");
         }
@@ -243,7 +243,7 @@
         }
     }
 
-    public Object setAttribute(String key, Object value) {
+    public Object setAttribute(Object key, Object value) {
         if (key == null) {
             throw new NullPointerException("key");
         }
@@ -255,11 +255,11 @@
         }
     }
 
-    public Object setAttribute(String key) {
+    public Object setAttribute(Object key) {
         return setAttribute(key, Boolean.TRUE);
     }
 
-    public Object setAttributeIfAbsent(String key, Object value) {
+    public Object setAttributeIfAbsent(Object key, Object value) {
         if (key == null) {
             throw new NullPointerException("key");
         }
@@ -278,7 +278,7 @@
         return oldValue;
     }
 
-    public Object removeAttribute(String key) {
+    public Object removeAttribute(Object key) {
         if (key == null) {
             throw new NullPointerException("key");
         }
@@ -286,7 +286,7 @@
         return attributes.remove(key);
     }
 
-    public boolean removeAttribute(String key, Object value) {
+    public boolean removeAttribute(Object key, Object value) {
         if (key == null) {
             throw new NullPointerException("key");
         }
@@ -305,7 +305,7 @@
         return false;
     }
 
-    public boolean replaceAttribute(String key, Object oldValue, Object 
newValue) {
+    public boolean replaceAttribute(Object key, Object oldValue, Object 
newValue) {
         synchronized (attributes) {
             Object actualOldValue = attributes.get(key);
             if (actualOldValue == null) {
@@ -321,13 +321,13 @@
         }
     }
 
-    public boolean containsAttribute(String key) {
+    public boolean containsAttribute(Object key) {
         return attributes.containsKey(key);
     }
 
-    public Set<String> getAttributeKeys() {
+    public Set<Object> getAttributeKeys() {
         synchronized (attributes) {
-            return new HashSet<String>(attributes.keySet());
+            return new HashSet<Object>(attributes.keySet());
         }
     }
 

Modified: mina/trunk/core/src/main/java/org/apache/mina/common/IoSession.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/common/IoSession.java?rev=580650&r1=580649&r2=580650&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/common/IoSession.java 
(original)
+++ mina/trunk/core/src/main/java/org/apache/mina/common/IoSession.java Sat Sep 
29 14:49:33 2007
@@ -137,7 +137,7 @@
      * @param key the key of the attribute
      * @return <tt>null</tt> if there is no attribute with the specified key
      */
-    Object getAttribute(String key);
+    Object getAttribute(Object key);
 
     /**
      * Returns the value of user defined attribute associated with the
@@ -154,7 +154,7 @@
      * }
      * </pre>
      */
-    Object getAttribute(String key, Object defaultValue);
+    Object getAttribute(Object key, Object defaultValue);
 
     /**
      * Sets a user-defined attribute.
@@ -163,7 +163,7 @@
      * @param value the value of the attribute
      * @return The old value of the attribute.  <tt>null</tt> if it is new.
      */
-    Object setAttribute(String key, Object value);
+    Object setAttribute(Object key, Object value);
 
     /**
      * Sets a user defined attribute without a value.  This is useful when
@@ -173,7 +173,7 @@
      * @param key the key of the attribute
      * @return The old value of the attribute.  <tt>null</tt> if it is new.
      */
-    Object setAttribute(String key);
+    Object setAttribute(Object key);
 
     /**
      * Sets a user defined attribute if the attribute with the specified key
@@ -187,14 +187,14 @@
      * }
      * </pre>
      */
-    Object setAttributeIfAbsent(String key, Object value);
+    Object setAttributeIfAbsent(Object key, Object value);
 
     /**
      * Removes a user-defined attribute with the specified key.
      *
      * @return The old value of the attribute.  <tt>null</tt> if not found.
      */
-    Object removeAttribute(String key);
+    Object removeAttribute(Object key);
 
     /**
      * Removes a user defined attribute with the specified key if the current
@@ -210,7 +210,7 @@
      * }
      * </pre>
      */
-    boolean removeAttribute(String key, Object value);
+    boolean removeAttribute(Object key, Object value);
 
     /**
      * Replaces a user defined attribute with the specified key if the
@@ -226,18 +226,18 @@
      * }
      * </pre>
      */
-    boolean replaceAttribute(String key, Object oldValue, Object newValue);
+    boolean replaceAttribute(Object key, Object oldValue, Object newValue);
 
     /**
      * Returns <tt>true</tt> if this session contains the attribute with
      * the specified <tt>key</tt>.
      */
-    boolean containsAttribute(String key);
+    boolean containsAttribute(Object key);
 
     /**
      * Returns the set of keys of all user-defined attributes.
      */
-    Set<String> getAttributeKeys();
+    Set<Object> getAttributeKeys();
 
     /**
      * Returns <code>true</code> if this session is connected with remote peer.


Reply via email to