camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r747055 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/impl/converter/ components/camel-web/src/main/java/org/apache/camel/web/resources/ components/camel-web/src/main/webapp/org/apache/camel/web/resources/ConvertersFromResource/
Date Mon, 23 Feb 2009 15:50:12 GMT
Author: jstrachan
Date: Mon Feb 23 15:50:11 2009
New Revision: 747055

URL: http://svn.apache.org/viewvc?rev=747055&view=rev
Log:
CAMEL-1355 - improved rendering of the available type converters

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java
    camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/ConvertersFromResource.java
    camel/trunk/components/camel-web/src/main/webapp/org/apache/camel/web/resources/ConvertersFromResource/index.jsp

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java?rev=747055&r1=747054&r2=747055&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java
Mon Feb 23 15:50:11 2009
@@ -22,6 +22,7 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.HashSet;
+import java.util.HashMap;
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.camel.Exchange;
@@ -177,12 +178,13 @@
         return answer;
     }
 
-    public Set<Class> getToClassMappings(Class fromClass) {
-        Set<Class> answer = new HashSet<Class>();
+    public Map<Class,TypeConverter> getToClassMappings(Class fromClass) {
+        Map<Class,TypeConverter> answer = new HashMap<Class,TypeConverter>();
         synchronized (typeMappings) {
-            for (TypeMapping mapping : typeMappings.keySet()) {
+            for (Map.Entry<TypeMapping, TypeConverter> entry : typeMappings.entrySet())
{
+                TypeMapping mapping = entry.getKey();
                 if (mapping.isApplicable(fromClass)) {
-                    answer.add(mapping.getToType());
+                    answer.put(mapping.getToType(), entry.getValue());
                 }
             }
         }

Modified: camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/ConvertersFromResource.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/ConvertersFromResource.java?rev=747055&r1=747054&r2=747055&view=diff
==============================================================================
--- camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/ConvertersFromResource.java
(original)
+++ camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/ConvertersFromResource.java
Mon Feb 23 15:50:11 2009
@@ -18,6 +18,7 @@
 package org.apache.camel.web.resources;
 
 import org.apache.camel.impl.converter.DefaultTypeConverter;
+import org.apache.camel.TypeConverter;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -35,14 +36,15 @@
         this.type = type;
     }
 
-    public Map<String, Class> getConverters() {
-        Map<String, Class> answer = new TreeMap<String, Class>();
+    public Map<String, TypeConverter> getConverters() {
+        Map<String, TypeConverter> answer = new TreeMap<String, TypeConverter>();
         DefaultTypeConverter converter = getDefaultTypeConverter();
         if (converter != null) {
-            Set<Class> classes = converter.getToClassMappings(type);
-            for (Class aClass : classes) {
+            Map<Class, TypeConverter> classes = converter.getToClassMappings(type);
+            for (Map.Entry<Class, TypeConverter> entry : classes.entrySet()) {
+                Class aClass = entry.getKey();
                 String name = ConvertersResource.nameOf(aClass);
-                answer.put(name, aClass);
+                answer.put(name, entry.getValue());
             }
         }
         return answer;

Modified: camel/trunk/components/camel-web/src/main/webapp/org/apache/camel/web/resources/ConvertersFromResource/index.jsp
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/webapp/org/apache/camel/web/resources/ConvertersFromResource/index.jsp?rev=747055&r1=747054&r2=747055&view=diff
==============================================================================
--- camel/trunk/components/camel-web/src/main/webapp/org/apache/camel/web/resources/ConvertersFromResource/index.jsp
(original)
+++ camel/trunk/components/camel-web/src/main/webapp/org/apache/camel/web/resources/ConvertersFromResource/index.jsp
Mon Feb 23 15:50:11 2009
@@ -7,14 +7,15 @@
 
 <h1>Type Converters from: ${it.type.name}</h1>
 
-
 <table>
   <tr>
     <th>To Type</th>
+    <th>Converter</th>
   </tr>
   <c:forEach items="${it.converters}" var="entry">
     <tr>
       <td>${entry.key}</td>
+      <td>${entry.value}</td>
     </tr>
   </c:forEach>
 </table>



Mime
View raw message