wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r819208 - in /incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common: internal/utils/JAXBUtils.java model/XmlFormattingOptions.java
Date Sat, 26 Sep 2009 20:47:32 GMT
Author: bluk
Date: Sat Sep 26 20:47:30 2009
New Revision: 819208

URL: http://svn.apache.org/viewvc?rev=819208&view=rev
Log:
Change XmlFormattingOptions to use properties

See [WINK-202]

Modified:
    incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/utils/JAXBUtils.java
    incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/XmlFormattingOptions.java

Modified: incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/utils/JAXBUtils.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/utils/JAXBUtils.java?rev=819208&r1=819207&r2=819208&view=diff
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/utils/JAXBUtils.java
(original)
+++ incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/utils/JAXBUtils.java
Sat Sep 26 20:47:30 2009
@@ -19,6 +19,8 @@
  *******************************************************************************/
 package org.apache.wink.common.internal.utils;
 
+import java.util.Map;
+
 import javax.ws.rs.WebApplicationException;
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
@@ -60,8 +62,10 @@
             return;
         }
         try {
-            marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, xfo.isIndenting());
-            marshaller.setProperty(Marshaller.JAXB_FRAGMENT, xfo.isOmitXmlDeclaration());
+            Map<String, Object> properties = xfo.getProperties();
+            for (String key : properties.keySet()) {
+                marshaller.setProperty(key, properties.get(key));
+            }
         } catch (Exception e) {
             throw new WebApplicationException(e);
         }

Modified: incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/XmlFormattingOptions.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/XmlFormattingOptions.java?rev=819208&r1=819207&r2=819208&view=diff
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/XmlFormattingOptions.java
(original)
+++ incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/XmlFormattingOptions.java
Sat Sep 26 20:47:30 2009
@@ -19,9 +19,12 @@
  *******************************************************************************/
 package org.apache.wink.common.model;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import javax.ws.rs.core.Application;
 import javax.ws.rs.ext.ContextResolver;
-
+import javax.xml.bind.Marshaller;
 
 /**
  * Holds the following XML Formatting Options:
@@ -52,13 +55,13 @@
  *     }
  * }
  * </pre>
+ * 
  * @see Application
  * @see ContextResolver
  */
 public class XmlFormattingOptions implements Cloneable {
 
-    private final boolean                     omitXmlDeclaration;
-    private final boolean                     indenting;
+    private final Map<String, Object>         properties;
     private final static XmlFormattingOptions defaultXmlFormattingOptions =
                                                                               new XmlFormattingOptions();
 
@@ -67,16 +70,21 @@
     }
 
     public XmlFormattingOptions(boolean omitXmlDeclaration, boolean indenting) {
-        this.omitXmlDeclaration = omitXmlDeclaration;
-        this.indenting = indenting;
+        properties = new HashMap<String, Object>();
+        if (omitXmlDeclaration) {
+            properties.put(Marshaller.JAXB_FRAGMENT, true);
+        }
+        if (indenting) {
+            properties.put(Marshaller.JAXB_FORMATTED_OUTPUT, true);
+        }
     }
 
-    public boolean isIndenting() {
-        return indenting;
+    public XmlFormattingOptions(Map<String, Object> properties) {
+        this.properties = properties;
     }
 
-    public boolean isOmitXmlDeclaration() {
-        return omitXmlDeclaration;
+    public Map<String, Object> getProperties() {
+        return properties;
     }
 
     public static XmlFormattingOptions getDefaultXmlFormattingOptions() {



Mime
View raw message