ws-commits mailing list archives

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

URL: http://svn.apache.org/r1697775
Log:
Avoid unnecessary indirections.

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/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=1697775&r1=1697774&r2=1697775&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 21:51:19 2015
@@ -47,20 +47,24 @@ public class FOMContent extends FOMExten
     protected FOMContent(String name, OMNamespace namespace, Type type, OMContainer parent,
OMFactory factory)
         throws OMException {
         super(name, namespace, parent, factory);
-        init(type);
+        setContentType(type);
     }
 
     protected FOMContent(QName qname, Type type, OMContainer parent, OMFactory factory) {
         super(qname, parent, factory);
-        init(type);
+        setContentType(type);
     }
 
     protected FOMContent(String localName, Type type, OMContainer parent, OMFactory factory,
OMXMLParserWrapper builder) {
         super(localName, parent, factory, builder);
-        init(type);
+        setContentType(type);
     }
 
-    private void init(Type type) {
+    public final Type getContentType() {
+        return type;
+    }
+
+    public Content setContentType(Type type) {
         this.type = type;
         if (Type.TEXT.equals(type))
             setAttributeValue(TYPE, "text");
@@ -73,14 +77,6 @@ public class FOMContent extends FOMExten
         else {
             removeAttribute(TYPE);
         }
-    }
-
-    public final Type getContentType() {
-        return type;
-    }
-
-    public Content setContentType(Type type) {
-        init(type);
         return this;
     }
 
@@ -104,10 +100,10 @@ public class FOMContent extends FOMExten
             }
 
             if (value instanceof Div && !type.equals(Content.Type.XML))
-                init(Content.Type.XHTML);
+                setContentType(Content.Type.XHTML);
             else {
                 if (mtype == null) {
-                    init(Content.Type.XML);
+                    setContentType(Content.Type.XML);
                 }
             }
             OMElement el = (OMElement)(value instanceof ElementWrapper ? ((ElementWrapper)value).getInternal()
: value);
@@ -214,7 +210,7 @@ public class FOMContent extends FOMExten
     }
 
     public <T extends Element> T setText(Content.Type type, String value) {
-        init(type);
+        setContentType(type);
         if (value != null) {
             OMNode child = this.getFirstOMChild();
             while (child != null) {

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=1697775&r1=1697774&r2=1697775&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 21:51:19 2015
@@ -40,21 +40,25 @@ public class FOMText extends FOMElement
     protected FOMText(Type type, String name, OMNamespace namespace, OMContainer parent,
OMFactory factory)
         throws OMException {
         super(name, namespace, parent, factory);
-        init(type);
+        setTextType(type);
     }
 
     protected FOMText(Type type, QName qname, OMContainer parent, OMFactory factory) throws
OMException {
         super(qname, parent, factory);
-        init(type);
+        setTextType(type);
     }
 
     protected FOMText(Type type, String localName, OMContainer parent, OMFactory factory,
OMXMLParserWrapper builder)
         throws OMException {
         super(localName, parent, factory, builder);
-        init(type);
+        setTextType(type);
     }
 
-    private void init(Type type) {
+    public final Type getTextType() {
+        return type;
+    }
+
+    public Text setTextType(Type type) {
         this.type = type;
         if (Type.TEXT.equals(type))
             setAttributeValue(TYPE, "text");
@@ -64,14 +68,6 @@ public class FOMText extends FOMElement
             setAttributeValue(TYPE, "xhtml");
         else
             removeAttribute(TYPE);
-    }
-
-    public final Type getTextType() {
-        return type;
-    }
-
-    public Text setTextType(Type type) {
-        init(type);
         return this;
     }
 
@@ -83,7 +79,7 @@ public class FOMText extends FOMElement
         if (value != null) {
             if (this.getFirstChildWithName(Constants.DIV) != null)
                 this.getFirstChildWithName(Constants.DIV).discard();
-            init(Text.Type.XHTML);
+            setTextType(Text.Type.XHTML);
             removeChildren();
             addChild((OMElement)value);
         } else
@@ -110,7 +106,7 @@ public class FOMText extends FOMElement
 //    }
 
     public <T extends Element> T setText(Text.Type type, String value) {
-        init(type);
+        setTextType(type);
         if (value != null) {
             OMNode child = this.getFirstOMChild();
             while (child != null) {



Mime
View raw message