Author: michiel
Date: 2010-02-16 00:24:34 +0100 (Tue, 16 Feb 2010)
New Revision: 41052

Modified:
   mmbase/trunk/utils/src/main/java/org/mmbase/util/BasicCaster.java
   mmbase/trunk/utils/src/main/java/org/mmbase/util/Caster.java
   mmbase/trunk/utils/src/main/java/org/mmbase/util/Casting.java
Log:
solved a TODO, moved Unwrappable back

Modified: mmbase/trunk/utils/src/main/java/org/mmbase/util/BasicCaster.java
===================================================================
--- mmbase/trunk/utils/src/main/java/org/mmbase/util/BasicCaster.java   
2010-02-15 23:17:56 UTC (rev 41051)
+++ mmbase/trunk/utils/src/main/java/org/mmbase/util/BasicCaster.java   
2010-02-15 23:24:34 UTC (rev 41052)
@@ -31,5 +31,8 @@
     public double toDouble(Object i) throws NotRecognized {
         throw NotRecognized.INSTANCE;
     }
+    public String toString(Object o) throws NotRecognized {
+        throw NotRecognized.INSTANCE;
+    }
 
 }
\ No newline at end of file

Modified: mmbase/trunk/utils/src/main/java/org/mmbase/util/Caster.java
===================================================================
--- mmbase/trunk/utils/src/main/java/org/mmbase/util/Caster.java        
2010-02-15 23:17:56 UTC (rev 41051)
+++ mmbase/trunk/utils/src/main/java/org/mmbase/util/Caster.java        
2010-02-15 23:24:34 UTC (rev 41052)
@@ -1,6 +1,7 @@
 package org.mmbase.util;
 import org.mmbase.util.transformers.CharTransformer;
 import java.util.*;
+import java.io.*;
 
 /**
  * @since MMBase-2.0
@@ -15,6 +16,7 @@
     long toLong(Object i) throws NotRecognized;
     float toFloat(Object i) throws NotRecognized;
     double toDouble(Object i) throws NotRecognized;
+    String toString(Object o) throws NotRecognized;
 
     public static class NotRecognized extends Exception {
         static NotRecognized INSTANCE = new NotRecognized();
@@ -23,11 +25,5 @@
 
     }
 
-    /**
-     * Clases implementing this will not be wrapped by {...@link #wrap}, even 
if the e.g. are CharSequence.
-     * @since MMBase-1.9
-     */
-    public static interface Unwrappable {
-    }
 
 }
\ No newline at end of file

Modified: mmbase/trunk/utils/src/main/java/org/mmbase/util/Casting.java
===================================================================
--- mmbase/trunk/utils/src/main/java/org/mmbase/util/Casting.java       
2010-02-15 23:17:56 UTC (rev 41051)
+++ mmbase/trunk/utils/src/main/java/org/mmbase/util/Casting.java       
2010-02-15 23:24:34 UTC (rev 41052)
@@ -347,12 +347,12 @@
             o = ((SortedBundle.ValueWrapper) o).getKey();
         }
         Object s = wrap(o, null);
-        // TODO
-        /*
-        if (s instanceof org.mmbase.bridge.Query) {
-            s = ((org.mmbase.bridge.Query) s).toSql();
+
+        try {
+            s = helper.toString(s);
+        } catch (Caster.NotRecognized e) {
+            // never mind
         }
-        */
         writer.write(s.toString());
         return writer;
     }
@@ -380,7 +380,7 @@
             // never mind
         }
 
-        if (o instanceof Caster.Unwrappable) {
+        if (o instanceof Unwrappable) {
             return o;
         } else if (o instanceof Date) {
             return new java.util.Date(((Date)o).getTime()) {
@@ -1209,7 +1209,7 @@
      * A SerializableInputStream where the toString represents the (escaped) 
contents of the stream itself.
      * @since MMBase-1.9.2
      */
-    static class StringSerializableInputStream extends SerializableInputStream 
implements Caster.Unwrappable {
+    static class StringSerializableInputStream extends SerializableInputStream 
implements Unwrappable {
         private static final long serialVersionUID = 2L;
 
         CharTransformer escaper;
@@ -1238,7 +1238,15 @@
         }
     }
 
+
     /**
+     * Clases implementing this will not be wrapped by {...@link #wrap}, even 
if the e.g. are CharSequence.
+     * @since MMBase-1.9
+     */
+    public static interface Unwrappable {
+    }
+
+    /**
      * @since MMBase-2.0
      */
     public static void setHelper(Caster h) {

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

Reply via email to