Author: michiel
Date: 2009-05-12 21:31:32 +0200 (Tue, 12 May 2009)
New Revision: 35115
Modified:
mmbase/trunk/src/org/mmbase/bridge/BridgeList.java
mmbase/trunk/src/org/mmbase/bridge/implementation/BasicList.java
mmbase/trunk/src/org/mmbase/bridge/util/AbstractBridgeList.java
mmbase/trunk/src/org/mmbase/bridge/util/AbstractSequentialBridgeList.java
mmbase/trunk/src/org/mmbase/bridge/util/BridgeCollections.java
Log:
Fix for MMB-1818
Modified: mmbase/trunk/src/org/mmbase/bridge/BridgeList.java
===================================================================
--- mmbase/trunk/src/org/mmbase/bridge/BridgeList.java 2009-05-12 18:21:19 UTC
(rev 35114)
+++ mmbase/trunk/src/org/mmbase/bridge/BridgeList.java 2009-05-12 19:31:32 UTC
(rev 35115)
@@ -10,11 +10,9 @@
package org.mmbase.bridge;
-import java.util.List;
-import java.util.Comparator;
+import java.util.*;
/**
- * A list of nodes
*
* @author Pierre van Rooden
* @version $Id$
@@ -30,7 +28,7 @@
* @param key the key of the property
* @return the property value
*/
- public Object getProperty(Object key);
+ Object getProperty(Object key);
/**
* Sets a property for this list.
@@ -39,20 +37,27 @@
* @param key the key of the property
* @param value the property value
*/
- public void setProperty(Object key, Object value);
+ void setProperty(Object key, Object value);
+
/**
+ * Returns an (unmodifiable) view on all properties of this list (See
{...@link #getProperty}).
+ * @since MMBase-1.9.1
+ */
+ Map<Object, Object> getProperties();
+
+ /**
* Sorts this list according to a default sort order.
*/
- public void sort();
+ void sort();
/**
* Sorts this list according to a specified sort order
*
* @param comparator the comparator defining the sort order
*/
- public void sort(Comparator<? super E> comparator); // ?
+ void sort(Comparator<? super E> comparator); // ?
- public BridgeList<E> subList(int fromIndex, int toIndex);
+ BridgeList<E> subList(int fromIndex, int toIndex);
}
Modified: mmbase/trunk/src/org/mmbase/bridge/implementation/BasicList.java
===================================================================
--- mmbase/trunk/src/org/mmbase/bridge/implementation/BasicList.java
2009-05-12 18:21:19 UTC (rev 35114)
+++ mmbase/trunk/src/org/mmbase/bridge/implementation/BasicList.java
2009-05-12 19:31:32 UTC (rev 35115)
@@ -52,6 +52,9 @@
public void setProperty(Object key, Object value) {
properties.put(key, value);
}
+ public Map<Object, Object> getProperties() {
+ return Collections.unmodifiableMap(properties);
+ }
/**
* converts the object in the list to the excpected format
Modified: mmbase/trunk/src/org/mmbase/bridge/util/AbstractBridgeList.java
===================================================================
--- mmbase/trunk/src/org/mmbase/bridge/util/AbstractBridgeList.java
2009-05-12 18:21:19 UTC (rev 35114)
+++ mmbase/trunk/src/org/mmbase/bridge/util/AbstractBridgeList.java
2009-05-12 19:31:32 UTC (rev 35115)
@@ -24,7 +24,7 @@
abstract public class AbstractBridgeList<E extends Comparable<? super E>>
extends AbstractList<E> implements BridgeList<E> {
- private Map<Object,Object> properties = new HashMap<Object,Object>();
+ private Map<Object, Object> properties = new HashMap<Object, Object>();
// javadoc inherited
public Object getProperty(Object key) {
@@ -36,6 +36,10 @@
properties.put(key, value);
}
+ public Map<Object, Object> getProperties() {
+ return Collections.unmodifiableMap(properties);
+ }
+
// javadoc inherited
public void sort() {
Collections.sort(this);
Modified:
mmbase/trunk/src/org/mmbase/bridge/util/AbstractSequentialBridgeList.java
===================================================================
--- mmbase/trunk/src/org/mmbase/bridge/util/AbstractSequentialBridgeList.java
2009-05-12 18:21:19 UTC (rev 35114)
+++ mmbase/trunk/src/org/mmbase/bridge/util/AbstractSequentialBridgeList.java
2009-05-12 19:31:32 UTC (rev 35115)
@@ -37,6 +37,10 @@
properties.put(key, value);
}
+ public Map<Object, Object> getProperties() {
+ return Collections.unmodifiableMap(properties);
+ }
+
// javadoc inherited
public void sort() {
Collections.sort(this);
Modified: mmbase/trunk/src/org/mmbase/bridge/util/BridgeCollections.java
===================================================================
--- mmbase/trunk/src/org/mmbase/bridge/util/BridgeCollections.java
2009-05-12 18:21:19 UTC (rev 35114)
+++ mmbase/trunk/src/org/mmbase/bridge/util/BridgeCollections.java
2009-05-12 19:31:32 UTC (rev 35115)
@@ -186,6 +186,10 @@
if (parent != null) return parent.getProperty(key);
return ((BridgeList<E>) c).getProperty(key);
}
+ public Map<Object, Object> getProperties() {
+ if (parent != null) return parent.getProperties();
+ return ((BridgeList<E>) c).getProperties();
+ }
public void setProperty(Object key, Object value) { throw new
UnsupportedOperationException(); }
public void sort() { throw new UnsupportedOperationException(); }
@@ -297,6 +301,7 @@
public boolean contains(Object obj) {return false;}
public Object getProperty(Object key) { return null; }
+ public Map<Object, Object> getProperties() { return
Collections.emptyMap(); }
public BridgeList<E> subList(int fromIndex, int toIndex) { throw new
IndexOutOfBoundsException(); }
public void setProperty(Object key, Object value) { throw new
UnsupportedOperationException(); }
public void sort() { throw new UnsupportedOperationException(); }
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs