Author: michiel
Date: 2009-05-29 15:40:17 +0200 (Fri, 29 May 2009)
New Revision: 35524

Modified:
   mmbase/trunk/src/org/mmbase/util/functions/AutodefiningParameters.java
   mmbase/trunk/src/org/mmbase/util/functions/BeanFunction.java
   mmbase/trunk/src/org/mmbase/util/functions/CloneNodeFunction.java
   mmbase/trunk/src/org/mmbase/util/functions/FunctionSets.java
   mmbase/trunk/src/org/mmbase/util/functions/Functions.java
   mmbase/trunk/src/org/mmbase/util/functions/GuiFunction.java
   mmbase/trunk/src/org/mmbase/util/functions/IndexFunction.java
   mmbase/trunk/src/org/mmbase/util/functions/MethodFunction.java
   mmbase/trunk/src/org/mmbase/util/functions/ReturnType.java
   mmbase/trunk/src/org/mmbase/util/functions/WrappedFunction.java
Log:
Generics and other conventions

Modified: mmbase/trunk/src/org/mmbase/util/functions/AutodefiningParameters.java
===================================================================
--- mmbase/trunk/src/org/mmbase/util/functions/AutodefiningParameters.java      
2009-05-29 13:39:38 UTC (rev 35523)
+++ mmbase/trunk/src/org/mmbase/util/functions/AutodefiningParameters.java      
2009-05-29 13:40:17 UTC (rev 35524)
@@ -21,6 +21,7 @@
  */
 
 public class AutodefiningParameters extends Parameters {
+    private static final long serialVersionUID = 0L;
     //private static Logger log = 
Logging.getLoggerInstance(AutodefiningParameters.class);
 
     public AutodefiningParameters(Parameter<?>[] base) {

Modified: mmbase/trunk/src/org/mmbase/util/functions/BeanFunction.java
===================================================================
--- mmbase/trunk/src/org/mmbase/util/functions/BeanFunction.java        
2009-05-29 13:39:38 UTC (rev 35523)
+++ mmbase/trunk/src/org/mmbase/util/functions/BeanFunction.java        
2009-05-29 13:40:17 UTC (rev 35524)
@@ -34,13 +34,14 @@
  */
 public class BeanFunction extends AbstractFunction<Object> {
 
-
+    private static final long serialVersionUID  = 0L;
     private static int producerSeq = 0;
     /**
      * @since MMBase-1.8.5
      */
     public static abstract class Producer {
         public abstract Object getInstance();
+        @Override
         public String toString() {
             return getClass().getName() + "." + (producerSeq++);
         }
@@ -68,9 +69,11 @@
      * A cache for bean classes. Used to avoid some reflection.
      */
     private static Cache<String, BeanFunction> beanFunctionCache = new 
Cache<String, BeanFunction>(50) {
+        @Override
         public String getName() {
             return "BeanFunctionCache";
         }
+        @Override
         public String getDescription() {
             return "ClassName.FunctionName -> BeanFunction object";
         }
@@ -109,6 +112,7 @@
                         throw new RuntimeException(e);
                     }
                 }
+            @Override
                 public String toString() {
                     return "";
                 }
@@ -119,11 +123,11 @@
      * argument one, and if that fails, simply newInstance is used.
      * @since MMBase-1.8.5
      */
-    public static Object getInstance(final Class claz, Object 
constructorArgument) throws IllegalAccessException, InstantiationException, 
InvocationTargetException {
+    public static <C> C getInstance(final Class<C> claz, Object 
constructorArgument) throws IllegalAccessException, InstantiationException, 
InvocationTargetException {
         Class c = constructorArgument.getClass();
         while (c != null) {
             try {
-                Constructor con = claz.getConstructor(c);
+                Constructor<C> con = claz.getConstructor(c);
                 return con.newInstance(constructorArgument);
             } catch (NoSuchMethodException e) {
                 c = c.getSuperclass();
@@ -132,7 +136,7 @@
         Class[] interfaces = constructorArgument.getClass().getInterfaces();
         for (Class element : interfaces) {
             try {
-                Constructor con = claz.getConstructor(element);
+                Constructor<C> con = claz.getConstructor(element);
                 return con.newInstance(constructorArgument);
             } catch (NoSuchMethodException e) {
             }
@@ -162,7 +166,7 @@
     /**
      * The constructor! Performs reflection to fill 'method' and 'setMethods' 
members.
      */
-    private  BeanFunction(Class claz, String name, Producer producer) throws 
IllegalAccessException, InstantiationException,  InvocationTargetException {
+    private  BeanFunction(Class<?> claz, String name, Producer producer) 
throws IllegalAccessException, InstantiationException,  
InvocationTargetException {
         super(name, null, null);
         this.producer = producer;
 
@@ -223,7 +227,7 @@
                         if (required) {
                             log.warn("Required annotation ignored, because a 
default value is present");
                         }
-                        parameters.add(new Parameter(parameterName, 
parameterTypes[0], defaultValue));
+                        parameters.add(new Parameter<Object>(parameterName, 
parameterTypes[0], defaultValue));
                     } else {
                         parameters.add(new Parameter(parameterName, 
parameterTypes[0], required));
                     }

Modified: mmbase/trunk/src/org/mmbase/util/functions/CloneNodeFunction.java
===================================================================
--- mmbase/trunk/src/org/mmbase/util/functions/CloneNodeFunction.java   
2009-05-29 13:39:38 UTC (rev 35523)
+++ mmbase/trunk/src/org/mmbase/util/functions/CloneNodeFunction.java   
2009-05-29 13:40:17 UTC (rev 35524)
@@ -22,7 +22,7 @@
  * @since MMBase-1.9.1
  */
 public class CloneNodeFunction extends NodeFunction<Node> {
-
+    private static final long serialVersionUID = 0L;
     private static final Logger log = 
Logging.getLoggerInstance(CloneNodeFunction.class);
 
     public static final Parameter<?>[] PARAMETERS = {

Modified: mmbase/trunk/src/org/mmbase/util/functions/FunctionSets.java
===================================================================
--- mmbase/trunk/src/org/mmbase/util/functions/FunctionSets.java        
2009-05-29 13:39:38 UTC (rev 35523)
+++ mmbase/trunk/src/org/mmbase/util/functions/FunctionSets.java        
2009-05-29 13:40:17 UTC (rev 35524)
@@ -128,7 +128,9 @@
         List<URL> resources = 
watcher.getResourceLoader().getResourceList("functionsets.xml");
         log.service("Using " + resources);
         ListIterator<URL> i = resources.listIterator();
-        while (i.hasNext()) i.next();
+        while (i.hasNext()) {
+            i.next();
+        }
         while (i.hasPrevious()) {
             try {
                 URL u = i.previous();
@@ -178,21 +180,21 @@
             String functionName = reader.getElementAttributeValue(element, 
"name");
             if (functionName != null) {
 
-                Element a = reader.getElementByPath(element, "function.type");
+                Element a = DocumentReader.getElementByPath(element, 
"function.type");
 
-                String type = reader.getElementValue(a); // 'class' or 
'instance'
+                String type = DocumentReader.getElementValue(a); // 'class' or 
'instance'
 
-                a = reader.getElementByPath(element, "function.description");
-                String description = reader.getElementValue(a);
+                a = DocumentReader.getElementByPath(element, 
"function.description");
+                String description = DocumentReader.getElementValue(a);
 
-                a = reader.getElementByPath(element, "function.class");
-                String className = reader.getElementValue(a);
+                a = DocumentReader.getElementByPath(element, "function.class");
+                String className = DocumentReader.getElementValue(a);
 
-                a = reader.getElementByPath(element, "function.method");
-                String methodName = reader.getElementValue(a);
+                a = DocumentReader.getElementByPath(element, 
"function.method");
+                String methodName = DocumentReader.getElementValue(a);
 
                 // read the return types and values
-                a = reader.getElementByPath(element, "function.return");
+                a = DocumentReader.getElementByPath(element, 
"function.return");
                 ReturnType returnType = null;
                 if (a != null) {
                     String returnTypeClassName = 
reader.getElementAttributeValue(a, "type");

Modified: mmbase/trunk/src/org/mmbase/util/functions/Functions.java
===================================================================
--- mmbase/trunk/src/org/mmbase/util/functions/Functions.java   2009-05-29 
13:39:38 UTC (rev 35523)
+++ mmbase/trunk/src/org/mmbase/util/functions/Functions.java   2009-05-29 
13:40:17 UTC (rev 35524)
@@ -53,7 +53,9 @@
         if (def == null) return list;
 
         int firstPattern = 0;
-        while (firstPattern < list.size() && ! (list.get(firstPattern) 
instanceof PatternParameter)) firstPattern++;
+        while (firstPattern < list.size() && ! (list.get(firstPattern) 
instanceof PatternParameter)) {
+            firstPattern++;
+        }
         boolean patterns = false;
         for (Parameter d : def) {
             if (d instanceof Parameter.Wrapper) {

Modified: mmbase/trunk/src/org/mmbase/util/functions/GuiFunction.java
===================================================================
--- mmbase/trunk/src/org/mmbase/util/functions/GuiFunction.java 2009-05-29 
13:39:38 UTC (rev 35523)
+++ mmbase/trunk/src/org/mmbase/util/functions/GuiFunction.java 2009-05-29 
13:40:17 UTC (rev 35524)
@@ -22,7 +22,7 @@
  * @since MMBase-1.9
  */
 public class GuiFunction extends NodeFunction<String> {
-
+    private static final long serialVersionUID = 0L;
     private static final Logger log = 
Logging.getLoggerInstance(GuiFunction.class);
     public static final Parameter<?>[] PARAMETERS = {
         Parameter.FIELD,

Modified: mmbase/trunk/src/org/mmbase/util/functions/IndexFunction.java
===================================================================
--- mmbase/trunk/src/org/mmbase/util/functions/IndexFunction.java       
2009-05-29 13:39:38 UTC (rev 35523)
+++ mmbase/trunk/src/org/mmbase/util/functions/IndexFunction.java       
2009-05-29 13:40:17 UTC (rev 35524)
@@ -42,9 +42,11 @@
     private static final Logger log = 
Logging.getLoggerInstance(IndexFunction.class);
 
     protected static Cache<String,String> indexCache = new 
Cache<String,String>(400) {
+        @Override
             public  String getName() {
                 return "IndexNumberCache";
             }
+        @Override
             public String getDescription() {
                 return "rootNumber/objectNumber -> Index";
             }
@@ -194,6 +196,7 @@
 
 
     protected static class Stack<C> extends ArrayList<C> {
+        private static final long serialVersionUID = 0L;
         public void push(C o) {
             add(0, o);
         }
@@ -203,146 +206,154 @@
     }
 
     protected static NodeFunction<String> index = new 
NodeFunction<String>("index", INDEX_ARGS, ReturnType.STRING) {
-            {
-                setDescription("Calculates the index of a node, using the 
surrounding 'indexrels'");
-            }
+        private static final long serialVersionUID = 0L;
 
-            /**
-             * complete bridge version of {...@link #getFunctionValue}
-             */
-            public String getFunctionValue(final Node node, final Parameters 
parameters) {
-                Node root     = parameters.get(ROOT);
-                final String role   = parameters.get(ROLE);
-                final String join   = parameters.get(JOINER);
-                final String separator   = parameters.get(SEPARATOR);
-                final Pattern indexPattern = Pattern.compile("(.+)" + 
separator + "(.+)");
-                final boolean roman   = parameters.get(ROMAN);
+        {
+            setDescription("Calculates the index of a node, using the 
surrounding 'indexrels'");
+        }
 
-                final String key = getKey(node, parameters);
+        /**
+         * complete bridge version of {...@link #getFunctionValue}
+         */
+        public String getFunctionValue(final Node node, final Parameters 
parameters) {
+            Node root = parameters.get(ROOT);
+            final String role = parameters.get(ROLE);
+            final String join = parameters.get(JOINER);
+            final String separator = parameters.get(SEPARATOR);
+            final Pattern indexPattern = Pattern.compile("(.+)" + separator + 
"(.+)");
+            final boolean roman = parameters.get(ROMAN);
 
-                initObserver();
-                String result = indexCache.get(key);
-                if (result != null) {
-                    if (log.isDebugEnabled()) {
-                        log.debug("Found index '" + result + "' for node " + 
node.getNumber() + " from cache (key " + key + ")");
-                    }
-                    return result;
+            final String key = getKey(node, parameters);
+
+            initObserver();
+            String result = indexCache.get(key);
+            if (result != null) {
+                if (log.isDebugEnabled()) {
+                    log.debug("Found index '" + result + "' for node " + 
node.getNumber() + " from cache (key " + key + ")");
                 }
-                log.debug("Determining index for node " + node.getNumber() + " 
with role " + role);
+                return result;
+            }
+            log.debug("Determining index for node " + node.getNumber() + " 
with role " + role);
 
-                final NodeManager nm = node.getNodeManager();
+            final NodeManager nm = node.getNodeManager();
 
-                // now we have to determine the path from node to root.
+            // now we have to determine the path from node to root.
 
-                GrowingTreeList tree = new 
GrowingTreeList(Queries.createNodeQuery(node), 10, nm, role, "source");
-                NodeQuery template = tree.getTemplate();
-                if (root != null) {
-                    StepField sf = template.addField(role + ".root");
-                    template.setConstraint(template.createConstraint(sf, 
root));
+            GrowingTreeList tree = new 
GrowingTreeList(Queries.createNodeQuery(node), 10, nm, role, "source");
+            NodeQuery template = tree.getTemplate();
+            if (root != null) {
+                StepField sf = template.addField(role + ".root");
+                template.setConstraint(template.createConstraint(sf, root));
+            }
+
+            Stack<Node> stack = new Stack<Node>();
+            TreeIterator it = tree.treeIterator();
+            int depth = it.currentDepth();
+            while (it.hasNext()) {
+                Node n = it.nextNode();
+                if (log.isDebugEnabled()) {
+                    log.debug("Considering at " + it.currentDepth() + "/" + 
depth + " node " + n.getNodeManager().getName() + " " + n.getNumber());
                 }
-
-                Stack<Node> stack = new Stack<Node>();
-                TreeIterator it = tree.treeIterator();
-                int depth = it.currentDepth();
-                while (it.hasNext()) {
-                    Node n = it.nextNode();
+                if (it.currentDepth() > depth) {
+                    stack.push(n);
+                    depth = it.currentDepth();
+                }
+                if (indexCache.contains(getKey(n, parameters))) {
                     if (log.isDebugEnabled()) {
-                        log.debug("Considering at " + it.currentDepth() + "/" 
+ depth + " node " + n.getNodeManager().getName() + " " + n.getNumber());
+                        log.debug("Index for " + n.getNumber() + " is known 
already!, breaking");
                     }
-                    if (it.currentDepth() > depth) {
-                        stack.push(n);
-                        depth = it.currentDepth();
-                    }
-                    if (indexCache.contains(getKey(n, parameters))) {
-                        if (log.isDebugEnabled()) {
-                            log.debug("Index for " + n.getNumber() + " is 
known already!, breaking");
-                        }
-                        break;
-                    }
-
-                    if (it.currentDepth() < depth) {
-                        break;
-                    }
-                    //if (root == null) root = n.getNodeValue(role + ".root");
-                    if (root != null && n.getNumber() == root.getNumber()) 
break;
+                    break;
                 }
 
-                if (stack.isEmpty()) {
-                    log.debug("Stack is empty, no root found, returning ''");
-                    indexCache.put(key, "");
-                    return "";
+                if (it.currentDepth() < depth) {
+                    break;
                 }
+                //if (root == null) root = n.getNodeValue(role + ".root");
+                if (root != null && n.getNumber() == root.getNumber()) {
+                    break;
+                }
+            }
 
+            if (stack.isEmpty()) {
+                log.debug("Stack is empty, no root found, returning ''");
+                indexCache.put(key, "");
+                return "";
+            }
+
+            if (log.isDebugEnabled()) {
+                log.debug("Now constructing index-number with " + stack.size() 
+ " nodes on stack");
+            }
+            Node n = stack.pull(); // this is root, or at least _its_ index is 
known
+            StringBuilder buf;
+            if (!n.equals(node)) {
+                buf = new StringBuilder(n.getFunctionValue("index", 
parameters).toString());
+            } else {
+                buf = new StringBuilder();
+            }
+            String j = buf.length() == 0 ? "" : join;
+            OUTER:
+            while (!stack.isEmpty()) {
+                Node search = stack.pull();
+                NodeQuery q = Queries.createRelatedNodesQuery(n, nm, role, 
"destination");
+                StepField sf = q.addField(role + ".pos");
+                q.addSortOrder(sf, SortOrder.ORDER_ASCENDING);
+                q.addField(role + ".index");
                 if (log.isDebugEnabled()) {
-                    log.debug("Now constructing index-number with " + 
stack.size() + " nodes on stack");
+                    log.debug("Executing " + q.toSql() + " to search " + 
search.getNumber());
                 }
-                Node n = stack.pull(); // this is root, or at least _its_ 
index is known
-                StringBuilder buf;
-                if (! n.equals(node)) {
-                    buf = new StringBuilder(n.getFunctionValue("index", 
parameters).toString());
-                } else {
-                    buf = new StringBuilder();
-                }
-                String j = buf.length() == 0 ? "" : join;
-                OUTER:
-                while(! stack.isEmpty()) {
-                    Node search = stack.pull();
-                    NodeQuery q = Queries.createRelatedNodesQuery(n, nm, role, 
"destination");
-                    StepField sf = q.addField(role + ".pos");
-                    q.addSortOrder(sf, SortOrder.ORDER_ASCENDING);
-                    q.addField(role + ".index");
-                    if (log.isDebugEnabled()) {
-                        log.debug("Executing " + q.toSql() + " to search " + 
search.getNumber());
+                String index = null;
+                NodeIterator ni = q.getCloud().getList(q).nodeIterator();
+                boolean doRoman = roman;
+                while (ni.hasNext()) {
+                    Node clusterFound = ni.nextNode();
+                    Node found = 
clusterFound.getNodeValue(q.getNodeStep().getAlias());
+                    String i = clusterFound.getStringValue(role + ".index");
+                    if (i == null || i.equals("")) {
+                        i = index;
                     }
-                    String index = null;
-                    NodeIterator ni = q.getCloud().getList(q).nodeIterator();
-                    boolean doRoman = roman;
-                    while(ni.hasNext()) {
-                        Node clusterFound = ni.nextNode();
-                        Node found = 
clusterFound.getNodeValue(q.getNodeStep().getAlias());
-                        String i = clusterFound.getStringValue(role + 
".index");
-                        if (i == null || i.equals("")) i = index;
-                        if (i == null) i = "1";
-                        log.debug("Found index " + i);
-                        Matcher matcher = indexPattern.matcher(i);
-                        if (matcher.matches()) {
-                            buf = new StringBuilder(matcher.group(1));
-                            i = matcher.group(2);
-                            log.debug("matched " + indexPattern + " --> " + i);
-                        }
-                        doRoman = doRoman && 
RomanTransformer.ROMAN.matcher(i).matches();
+                    if (i == null) {
+                        i = "1";
+                    }
+                    log.debug("Found index " + i);
+                    Matcher matcher = indexPattern.matcher(i);
+                    if (matcher.matches()) {
+                        buf = new StringBuilder(matcher.group(1));
+                        i = matcher.group(2);
+                        log.debug("matched " + indexPattern + " --> " + i);
+                    }
+                    doRoman = doRoman && 
RomanTransformer.ROMAN.matcher(i).matches();
 
-                        boolean explicitEmpty = "-".equals(i) || 
"--".equals(i);
-                        if (found.getNumber() == search.getNumber()) {
-                            log.debug("found sibling");
-                            // found!
-                            if (! explicitEmpty) {
-                                buf.append(j).append(i);
-                            } else {
-                                buf.setLength(0);
-                            }
-                            j = join;
-                            n = found;
-                            continue OUTER;
+                    boolean explicitEmpty = "-".equals(i) || "--".equals(i);
+                    if (found.getNumber() == search.getNumber()) {
+                        log.debug("found sibling");
+                        // found!
+                        if (!explicitEmpty) {
+                            buf.append(j).append(i);
+                        } else {
+                            buf.setLength(0);
                         }
-                        index = successor(i, separator, join, doRoman);
+                        j = join;
+                        n = found;
+                        continue OUTER;
+                    }
+                    index = successor(i, separator, join, doRoman);
 
-                        String hapKey = getKey(found, parameters);
-                        String value = explicitEmpty ? "" :  buf.toString() + 
j + i;
-                        log.debug("Caching " + key + "->" + value);
-                        // can as well cache this one too.
-                        indexCache.put(hapKey, value);
-                    }
-                    // not found
-                    buf.append(j).append("???");
-                    break;
+                    String hapKey = getKey(found, parameters);
+                    String value = explicitEmpty ? "" : buf.toString() + j + i;
+                    log.debug("Caching " + key + "->" + value);
+                    // can as well cache this one too.
+                    indexCache.put(hapKey, value);
                 }
-                String r = buf.toString();
-                log.debug("Found '" + r  + "' for " + key);
-                indexCache.put(key, r);
-                return r;
+                // not found
+                buf.append(j).append("???");
+                break;
             }
-        };
+            String r = buf.toString();
+            log.debug("Found '" + r + "' for " + key);
+            indexCache.put(key, r);
+            return r;
+        }
+    };
     {
         addFunction(index);
     }

Modified: mmbase/trunk/src/org/mmbase/util/functions/MethodFunction.java
===================================================================
--- mmbase/trunk/src/org/mmbase/util/functions/MethodFunction.java      
2009-05-29 13:39:38 UTC (rev 35523)
+++ mmbase/trunk/src/org/mmbase/util/functions/MethodFunction.java      
2009-05-29 13:40:17 UTC (rev 35524)
@@ -40,6 +40,7 @@
  * @since MMBase-1.7
  */
 public class MethodFunction extends AbstractFunction<Object> {
+    private static final long serialVersionUID = 0L;
     private static final Logger log = 
Logging.getLoggerInstance(MethodFunction.class);
 
 

Modified: mmbase/trunk/src/org/mmbase/util/functions/ReturnType.java
===================================================================
--- mmbase/trunk/src/org/mmbase/util/functions/ReturnType.java  2009-05-29 
13:39:38 UTC (rev 35523)
+++ mmbase/trunk/src/org/mmbase/util/functions/ReturnType.java  2009-05-29 
13:40:17 UTC (rev 35524)
@@ -23,43 +23,43 @@
  * @since MMBase-1.7
  */
 public class ReturnType<C> extends Parameter<C> implements 
java.io.Serializable {
-
+    private static final long serialVersionUID = 0L;
     /**
      * The return type of a function that does not return a thing.
      */
-    public static final ReturnType<Void> VOID = new ReturnType(void.class, 
"Does not return anything");
+    public static final ReturnType<Void> VOID = new 
ReturnType<Void>(void.class, "Does not return anything");
 
     /**
      * The return type of a function that returns a String.
      */
-    public static final ReturnType<String> STRING = new 
ReturnType(String.class, "String");
+    public static final ReturnType<String> STRING = new 
ReturnType<String>(String.class, "String");
 
-    public static final ReturnType<CharSequence> CHARSEQUENCE = new 
ReturnType(CharSequence.class, "CharSequence");
+    public static final ReturnType<CharSequence> CHARSEQUENCE = new 
ReturnType<CharSequence>(CharSequence.class, "CharSequence");
 
     /**
      * The return type of a function that returns a Integer.
      */
-    public static final ReturnType<Integer> INTEGER = new 
ReturnType(Integer.class, "Integer");
+    public static final ReturnType<Integer> INTEGER = new 
ReturnType<Integer>(Integer.class, "Integer");
 
     /**
      * The return type of a function that returns a Long.
      */
-    public static final ReturnType<Long> LONG = new ReturnType(Long.class, 
"Long");
+    public static final ReturnType<Long> LONG = new 
ReturnType<Long>(Long.class, "Long");
 
     /**
      * The return type of a function that returns a Double.
      */
-    public static final ReturnType<Double> DOUBLE = new 
ReturnType(Double.class, "Double");
+    public static final ReturnType<Double> DOUBLE = new 
ReturnType<Double>(Double.class, "Double");
 
     /**
      * The return type of a function that returns a Boolean.
      */
-    public static final ReturnType<Boolean> BOOLEAN = new 
ReturnType(Boolean.class, "Boolean");
+    public static final ReturnType<Boolean> BOOLEAN = new 
ReturnType<Boolean>(Boolean.class, "Boolean");
 
     /**
      * The return type of a function that returns a List.
      */
-    public static final ReturnType LIST = new ReturnType(List.class, "List");
+    public static final ReturnType<List> LIST = new 
ReturnType<List>(List.class, "List");
 
 
     /**
@@ -75,26 +75,26 @@
     /**
      * The return type of a function that returns a Set.
      */
-    public static final ReturnType SET = new ReturnType(Set.class, "Set");
+    public static final ReturnType<Set<?>> SET = new 
ReturnType<Set<?>>(Set.class, "Set");
     /**
      * The return type of a function that returns a Set.
      */
-    public static final ReturnType COLLECTION = new 
ReturnType(Collection.class, "Collection");
+    public static final ReturnType<Collection<?>> COLLECTION = new 
ReturnType<Collection<?>>(Collection.class, "Collection");
 
     /**
      * The return type of a function that returns a Map.
      */
-    public static final ReturnType MAP = new ReturnType(Map.class, "Map");
+    public static final ReturnType<Map<?, ?>> MAP = new ReturnType<Map<?, 
?>>(Map.class, "Map");
 
     /**
      * The return type of a function is unknown.
      */
-    public static final ReturnType UNKNOWN = new ReturnType(Object.class, 
"unknown");
+    public static final ReturnType<Object> UNKNOWN = new 
ReturnType<Object>(Object.class, "unknown");
 
     /**
      * The return type of a function is None
      */
-    public static final ReturnType NONE = new ReturnType(Object.class, "none");
+    public static final ReturnType<Object> NONE = new 
ReturnType<Object>(Object.class, "none");
 
     /**
      * Can be return by functions that don't want to return anything. (The 
function framework
@@ -135,17 +135,18 @@
         } else if (type.equals(Void.class)) {
             return VOID;
         } else {
-            return new ReturnType(type, type.getName());
+            return new ReturnType<Object>(type, type.getName());
         }
     }
 
-    private Map<String, ReturnType> typeStruct = new HashMap<String, 
ReturnType>(); 
+    private Map<String, ReturnType> typeStruct = new HashMap<String, 
ReturnType>();
 
     public  ReturnType(Class type, String description) {
         super("RETURN_VALUE", type);
         setDescription(description, null);
     }
 
+    @Override
     public boolean isRequired() {
         return false;
     }

Modified: mmbase/trunk/src/org/mmbase/util/functions/WrappedFunction.java
===================================================================
--- mmbase/trunk/src/org/mmbase/util/functions/WrappedFunction.java     
2009-05-29 13:39:38 UTC (rev 35523)
+++ mmbase/trunk/src/org/mmbase/util/functions/WrappedFunction.java     
2009-05-29 13:40:17 UTC (rev 35524)
@@ -83,9 +83,23 @@
         wrappedFunction.setReturnType(type);
     }
 
+    @Override
     public int hashCode() {
         return getName().hashCode();
     }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final WrappedFunction<R> other = (WrappedFunction<R>) obj;
+        return other.getClass().equals(getClass());
+    }
+    @Override
     public String toString() {
         return "WRAPPED " + wrappedFunction.toString();
     }

_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to