ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1697782 - in /webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax: FOMContent.java FOMElement.java FOMFactory.java FOMText.java
Date Tue, 25 Aug 2015 22:48:03 GMT
Author: veithen
Date: Tue Aug 25 22:48:03 2015
New Revision: 1697782

URL: http://svn.apache.org/r1697782
Log:
Some code simplifications.

Modified:
    webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMContent.java
    webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
    webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
    webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMText.java

Modified: webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMContent.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMContent.java?rev=1697782&r1=1697781&r2=1697782&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMContent.java
(original)
+++ webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMContent.java
Tue Aug 25 22:48:03 2015
@@ -44,10 +44,9 @@ import org.apache.axiom.util.base64.Base
 public class FOMContent extends FOMExtensibleElement implements AbderaContent {
     protected Type type = Type.TEXT;
 
-    protected FOMContent(String name, OMNamespace namespace, Type type, OMContainer parent,
OMFactory factory)
+    protected FOMContent(String name, OMNamespace namespace, OMContainer parent, OMFactory
factory)
         throws OMException {
         super(name, namespace, parent, factory);
-        setContentType(type);
     }
 
     protected FOMContent(QName qname, Type type, OMContainer parent, OMFactory factory) {

Modified: webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMElement.java?rev=1697782&r1=1697781&r2=1697782&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
(original)
+++ webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
Tue Aug 25 22:48:03 2015
@@ -586,16 +586,13 @@ public class FOMElement extends OMElemen
     }
 
     protected OMElement _create(OMElement src) {
-        OMElement el = null;
-
         FOMFactory fomfactory = (FOMFactory)getOMFactory();
-        Object obj = null;
-        if (src instanceof Content)
-            obj = ((Content)src).getContentType();
-        if (src instanceof Text)
-            obj = ((Text)src).getTextType();
-        el = fomfactory.createElement(src.getQName(), (OMContainer)fomfactory.newDocument(),
obj);
-
+        OMElement el = fomfactory.createElement(src.getQName(), (OMContainer)fomfactory.newDocument());
+        if (src instanceof Content) {
+            ((Content)el).setContentType(((Content)src).getContentType());
+        } else if (src instanceof Text) {
+            ((Text)el).setTextType(((Text)src).getTextType());
+        }
         return el;
     }
 

Modified: webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java?rev=1697782&r1=1697781&r2=1697782&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
(original)
+++ webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
Tue Aug 25 22:48:03 2015
@@ -267,7 +267,7 @@ public class FOMFactory extends OMLinked
 
     public <T extends Element> T newExtensionElement(QName qname, Base parent) {
         String ns = qname.getNamespaceURI();
-        Element el = (Element)createElement(qname, (OMContainer)parent, null);
+        Element el = (Element)createElement(qname, (OMContainer)parent);
         return (T)((ATOM_NS.equals(ns) || APP_NS.equals(ns)) ? el : factoriesMap.getElementWrapper(el));
     }
 
@@ -431,7 +431,7 @@ public class FOMFactory extends OMLinked
         return new FOMDiv(DIV, (OMContainer)parent, this);
     }
 
-    protected OMElement createElement(QName qname, OMContainer parent, Object objecttype)
{
+    protected OMElement createElement(QName qname, OMContainer parent) {
         OMElement element = null;
         OMNamespace namespace = this.createOMNamespace(qname.getNamespaceURI(), qname.getPrefix());
         if (FEED.equals(qname)) {
@@ -445,8 +445,7 @@ public class FOMFactory extends OMLinked
         } else if (CATEGORY.equals(qname)) {
             element = new FOMCategory(qname.getLocalPart(), namespace, parent, this);
         } else if (CONTENT.equals(qname)) {
-            Content.Type type = (Content.Type)objecttype;
-            element = new FOMContent(qname.getLocalPart(), namespace, type, parent, this);
+            element = new FOMContent(qname.getLocalPart(), namespace, parent, this);
         } else if (CONTRIBUTOR.equals(qname)) {
             element = new FOMPerson(qname.getLocalPart(), namespace, parent, this);
         } else if (GENERATOR.equals(qname)) {
@@ -462,19 +461,15 @@ public class FOMFactory extends OMLinked
         } else if (PUBLISHED.equals(qname)) {
             element = new FOMDateTime(qname.getLocalPart(), namespace, parent, this);
         } else if (RIGHTS.equals(qname)) {
-            Text.Type type = (Text.Type)objecttype;
-            element = new FOMText(type, qname.getLocalPart(), namespace, parent, this);
+            element = new FOMText(qname.getLocalPart(), namespace, parent, this);
         } else if (SOURCE.equals(qname)) {
             element = new FOMSource(qname.getLocalPart(), namespace, parent, this);
         } else if (SUBTITLE.equals(qname)) {
-            Text.Type type = (Text.Type)objecttype;
-            element = new FOMText(type, qname.getLocalPart(), namespace, parent, this);
+            element = new FOMText(qname.getLocalPart(), namespace, parent, this);
         } else if (SUMMARY.equals(qname)) {
-            Text.Type type = (Text.Type)objecttype;
-            element = new FOMText(type, qname.getLocalPart(), namespace, parent, this);
+            element = new FOMText(qname.getLocalPart(), namespace, parent, this);
         } else if (TITLE.equals(qname)) {
-            Text.Type type = (Text.Type)objecttype;
-            element = new FOMText(type, qname.getLocalPart(), namespace, parent, this);
+            element = new FOMText(qname.getLocalPart(), namespace, parent, this);
         } else if (UPDATED.equals(qname)) {
             element = new FOMDateTime(qname.getLocalPart(), namespace, parent, this);
         } else if (WORKSPACE.equals(qname) || PRE_RFC_WORKSPACE.equals(qname)) {

Modified: webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMText.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMText.java?rev=1697782&r1=1697781&r2=1697782&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMText.java
(original)
+++ webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMText.java
Tue Aug 25 22:48:03 2015
@@ -37,10 +37,9 @@ import org.apache.axiom.om.OMXMLParserWr
 public class FOMText extends FOMElement implements AbderaText {
     protected Type type = Type.TEXT;
 
-    protected FOMText(Type type, String name, OMNamespace namespace, OMContainer parent,
OMFactory factory)
+    protected FOMText(String name, OMNamespace namespace, OMContainer parent, OMFactory factory)
         throws OMException {
         super(name, namespace, parent, factory);
-        setTextType(type);
     }
 
     protected FOMText(Type type, QName qname, OMContainer parent, OMFactory factory) throws
OMException {



Mime
View raw message