scolebourne 2003/10/03 16:19:32
Modified: collections/src/java/org/apache/commons/collections/decorators
OrderedMap.java
collections/src/java/org/apache/commons/collections
DefaultMapEntry.java ReferenceMap.java BeanMap.java
Log:
Deprecate DefaultMapEntry in the main package
Fix resultant deprecation warnings
Revision Changes Path
1.4 +3 -3
jakarta-commons/collections/src/java/org/apache/commons/collections/decorators/OrderedMap.java
Index: OrderedMap.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/decorators/OrderedMap.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- OrderedMap.java 3 Oct 2003 06:31:03 -0000 1.3
+++ OrderedMap.java 3 Oct 2003 23:19:32 -0000 1.4
@@ -64,7 +64,7 @@
import java.util.Map;
import java.util.Set;
-import org.apache.commons.collections.DefaultMapEntry;
+import org.apache.commons.collections.pairs.DefaultMapEntry;
/**
* Decorates a <code>Map</code> to ensure that the order of addition
1.14 +4 -2
jakarta-commons/collections/src/java/org/apache/commons/collections/DefaultMapEntry.java
Index: DefaultMapEntry.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/DefaultMapEntry.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- DefaultMapEntry.java 3 Oct 2003 06:20:54 -0000 1.13
+++ DefaultMapEntry.java 3 Oct 2003 23:19:32 -0000 1.14
@@ -69,6 +69,8 @@
* @author Michael A. Smith
* @author Neil O'Toole
* @author Stephen Colebourne
+ *
+ * @deprecated Use the version in the pairs subpackage.
*/
public class DefaultMapEntry implements Map.Entry {
1.15 +8 -9
jakarta-commons/collections/src/java/org/apache/commons/collections/ReferenceMap.java
Index: ReferenceMap.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/ReferenceMap.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- ReferenceMap.java 31 Aug 2003 17:26:44 -0000 1.14
+++ ReferenceMap.java 3 Oct 2003 23:19:32 -0000 1.15
@@ -4,7 +4,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2002-2003 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -76,6 +76,8 @@
import java.util.NoSuchElementException;
import java.util.Set;
+import org.apache.commons.collections.pairs.DefaultMapEntry;
+
/**
* Hashtable-based [EMAIL PROTECTED] Map} implementation that allows
* mappings to be removed by the garbage collector.<p>
@@ -643,18 +645,18 @@
* @return a set view of this map's entries
*/
public Set entrySet() {
- if (entrySet != null) return entrySet;
+ if (entrySet != null) {
+ return entrySet;
+ }
entrySet = new AbstractSet() {
public int size() {
return ReferenceMap.this.size();
}
-
public void clear() {
ReferenceMap.this.clear();
}
-
public boolean contains(Object o) {
if (o == null) return false;
if (!(o instanceof Map.Entry)) return false;
@@ -663,7 +665,6 @@
return (e2 != null) && e.equals(e2);
}
-
public boolean remove(Object o) {
boolean r = contains(o);
if (r) {
@@ -673,7 +674,6 @@
return r;
}
-
public Iterator iterator() {
return new EntryIterator();
}
@@ -681,7 +681,6 @@
public Object[] toArray() {
return toArray(new Object[0]);
}
-
public Object[] toArray(Object[] arr) {
ArrayList list = new ArrayList();
1.22 +11 -8
jakarta-commons/collections/src/java/org/apache/commons/collections/BeanMap.java
Index: BeanMap.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/BeanMap.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- BeanMap.java 31 Aug 2003 17:26:44 -0000 1.21
+++ BeanMap.java 3 Oct 2003 23:19:32 -0000 1.22
@@ -73,6 +73,8 @@
import java.util.Iterator;
import java.util.Set;
+import org.apache.commons.collections.pairs.AbstractMapEntry;
+
/**
* An implementation of Map for JavaBeans which uses introspection to
* get and put properties in the bean.
@@ -83,7 +85,7 @@
* @since Commons Collections 1.0
* @version $Revision$ $Date$
*
- * @author <a href="mailto:[EMAIL PROTECTED]">James Strachan</a>
+ * @author James Strachan
* @author Stephen Colebourne
*/
public class BeanMap extends AbstractMap implements Cloneable {
@@ -446,10 +448,11 @@
}
/**
- * Get the mappings for this BeanMap
+ * Gets a Set of MapEntry objects that are the mappings for this BeanMap.
+ * <p>
+ * Each MapEntry can be set but not removed.
*
- * @return BeanMap mappings. The Set returned by this method
- * is not modifiable.
+ * @return the unmodifiable set of mappings
*/
public Set entrySet() {
return Collections.unmodifiableSet(new AbstractSet() {
@@ -465,7 +468,7 @@
public Object next() {
Object key = (Object)methodIter.next();
- return new DefaultMapEntry(key, get(key));
+ return new MyMapEntry( BeanMap.this, key, get(key) );
}
public void remove() {
@@ -699,7 +702,7 @@
/**
* Map entry used by [EMAIL PROTECTED] BeanMap}.
*/
- protected static class MyMapEntry extends DefaultMapEntry {
+ protected static class MyMapEntry extends AbstractMapEntry {
private BeanMap owner;
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]