camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r707373 - /activemq/camel/trunk/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/XStreamDataFormat.java
Date Thu, 23 Oct 2008 13:41:00 GMT
Author: jstrachan
Date: Thu Oct 23 06:41:00 2008
New Revision: 707373

URL: http://svn.apache.org/viewvc?rev=707373&view=rev
Log:
added a factory method to make it easier to create an annotated set of classes for XStream
: see http://www.nabble.com/Xstream-marshalling---Alias-tp20089956s22882p20130279.html

Modified:
    activemq/camel/trunk/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/XStreamDataFormat.java

Modified: activemq/camel/trunk/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/XStreamDataFormat.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/XStreamDataFormat.java?rev=707373&r1=707372&r2=707373&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/XStreamDataFormat.java
(original)
+++ activemq/camel/trunk/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/XStreamDataFormat.java
Thu Oct 23 06:41:00 2008
@@ -46,6 +46,30 @@
     private XStream xstream;
     private StaxConverter staxConverter;
 
+    /**
+     * A factory method which takes a collection of types to be annotated
+     */
+    public static XStreamDataFormat processAnnotations(Iterable<Class<?>> types)
{
+        XStreamDataFormat answer = new XStreamDataFormat();
+        XStream xstream = answer.getXStream();
+        for (Class<?> type : types) {
+            xstream.processAnnotations(type);
+        }
+        return answer;
+    }
+
+    /**
+     * A factory method which takes a number of types to be annotated
+     */
+    public static XStreamDataFormat processAnnotations(Class<?>... types) {
+        XStreamDataFormat answer = new XStreamDataFormat();
+        XStream xstream = answer.getXStream();
+        for (Class<?> type : types) {
+            xstream.processAnnotations(type);
+        }
+        return answer;
+    }
+
     public XStreamDataFormat() {
     }
 



Mime
View raw message