ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1706530 - in /webservices/axiom/trunk: aspects/fom-aspects/src/main/java/org/apache/axiom/fom/ implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/
Date Sat, 03 Oct 2015 09:24:39 GMT
Author: veithen
Date: Sat Oct  3 09:24:38 2015
New Revision: 1706530

URL: http://svn.apache.org/viewvc?rev=1706530&view=rev
Log:
Replace getFirstChildWithName with code using the core model API.

Modified:
    webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaElement.java
    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/FOMEntry.java
    webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMExtensibleElement.java
    webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java
    webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMPerson.java
    webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMSource.java
    webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMText.java

Modified: webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaElement.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaElement.java?rev=1706530&r1=1706529&r2=1706530&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaElement.java
(original)
+++ webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/AbderaElement.java
Sat Oct  3 09:24:38 2015
@@ -33,4 +33,5 @@ public interface AbderaElement extends E
     void _removeChildren(QName qname, boolean many);
     String _getElementValue(QName qname);
     void _setElementValue(QName qname, String value);
+    AbderaElement _getFirstChildWithName(QName qname);
 }

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=1706530&r1=1706529&r2=1706530&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
Sat Oct  3 09:24:38 2015
@@ -175,7 +175,7 @@ public class FOMContent extends FOMExten
         } else if (Type.HTML.equals(type)) {
             val = getText();
         } else if (Type.XHTML.equals(type)) {
-            FOMDiv div = (FOMDiv)this.getFirstChildWithName(Constants.DIV);
+            FOMDiv div = (FOMDiv)_getFirstChildWithName(Constants.DIV);
             if (div != null)
                 val = div.getInternalValue();
         } else if (Type.XML.equals(type)) {
@@ -262,7 +262,7 @@ public class FOMContent extends FOMExten
 
     public String getWrappedValue() {
         if (Type.XHTML.equals(type)) {
-            return this.getFirstChildWithName(Constants.DIV).toString();
+            return _getFirstChildWithName(Constants.DIV).toString();
         } else {
             return getText();
         }

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=1706530&r1=1706529&r2=1706530&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
Sat Oct  3 09:24:38 2015
@@ -143,7 +143,7 @@ public class FOMElement extends FOMChild
     }
 
     public <T extends Element> T getFirstChild(QName qname) {
-        return (T)getWrapped((Element)this.getFirstChildWithName(qname));
+        return (T)getWrapped(_getFirstChildWithName(qname));
     }
 
     public Lang getLanguageTag() {
@@ -234,20 +234,23 @@ public class FOMElement extends FOMChild
         return new FOMList(new FOMElementIteratorWrapper(factory, _getChildrenWithName(qname)));
     }
 
-    public void _setChild(QName qname, Element element) {
-        AbderaElement e = null;
+    public final AbderaElement _getFirstChildWithName(QName qname) {
         CoreChildNode child = coreGetFirstChild();
         while (child != null) {
             if (child instanceof AbderaElement) {
                 AbderaElement candidate = (AbderaElement)child;
                 if (candidate.coreGetLocalName().equals(qname.getLocalPart())
                         && candidate.coreGetNamespaceURI().equals(qname.getNamespaceURI()))
{
-                    e = candidate;
-                    break;
+                    return candidate;
                 }
             }
             child = child.coreGetNextSibling();
         }
+        return null;
+    }
+
+    public void _setChild(QName qname, Element element) {
+        AbderaElement e = _getFirstChildWithName(qname);
         if (e == null && element != null) {
             coreAppendChild((AbderaElement)element, false);
         } else if (e != null && element != null) {
@@ -329,7 +332,7 @@ public class FOMElement extends FOMChild
     }
 
     public void _setElementValue(QName qname, String value) {
-        OMElement element = this.getFirstChildWithName(qname);
+        OMElement element = (OMElement)_getFirstChildWithName(qname);
         if (element != null && value != null) {
             element.setText(value);
         } else if (element != null && value == null) {
@@ -346,14 +349,14 @@ public class FOMElement extends FOMChild
 
     public String _getElementValue(QName qname) {
         String value = null;
-        OMElement element = this.getFirstChildWithName(qname);
+        AbderaElement element = _getFirstChildWithName(qname);
         if (element != null)
             value = element.getText();
         return getMustPreserveWhitespace() || value == null ? value : value.trim();
     }
 
     protected <T extends Text> T getTextElement(QName qname) {
-        return (T)getFirstChildWithName(qname);
+        return (T)_getFirstChildWithName(qname);
     }
 
     protected <T extends Text> void setTextElement(QName qname, T text, boolean many)
{

Modified: webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java?rev=1706530&r1=1706529&r2=1706530&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java
(original)
+++ webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java
Sat Oct  3 09:24:38 2015
@@ -70,7 +70,7 @@ import org.apache.axiom.om.OMElement;
 @SuppressWarnings( {"unchecked", "deprecation"})
 public class FOMEntry extends FOMExtensibleElement implements AbderaEntry {
     public Person getAuthor() {
-        return (Person)getFirstChildWithName(AUTHOR);
+        return (Person)_getFirstChildWithName(AUTHOR);
     }
 
     public List<Person> getAuthors() {
@@ -102,7 +102,7 @@ public class FOMEntry extends FOMExtensi
     }
 
     public Content getContentElement() {
-        return (Content)getFirstChildWithName(CONTENT);
+        return (Content)_getFirstChildWithName(CONTENT);
     }
 
     public Entry setContentElement(Content content) {
@@ -293,7 +293,7 @@ public class FOMEntry extends FOMExtensi
     }
 
     public IRIElement getIdElement() {
-        return (IRIElement)getFirstChildWithName(ID);
+        return (IRIElement)_getFirstChildWithName(ID);
     }
 
     public Entry setIdElement(IRIElement id) {
@@ -374,7 +374,7 @@ public class FOMEntry extends FOMExtensi
     }
 
     public DateTime getPublishedElement() {
-        return (DateTime)getFirstChildWithName(PUBLISHED);
+        return (DateTime)_getFirstChildWithName(PUBLISHED);
     }
 
     public Entry setPublishedElement(DateTime dateTime) {
@@ -454,7 +454,7 @@ public class FOMEntry extends FOMExtensi
     }
 
     public Source getSource() {
-        return (Source)getFirstChildWithName(SOURCE);
+        return (Source)_getFirstChildWithName(SOURCE);
     }
 
     public Entry setSource(Source source) {
@@ -549,7 +549,7 @@ public class FOMEntry extends FOMExtensi
     }
 
     public DateTime getUpdatedElement() {
-        return (DateTime)getFirstChildWithName(UPDATED);
+        return (DateTime)_getFirstChildWithName(UPDATED);
     }
 
     public Entry setUpdatedElement(DateTime updated) {
@@ -587,9 +587,9 @@ public class FOMEntry extends FOMExtensi
     }
 
     public DateTime getEditedElement() {
-        DateTime dt = (DateTime)getFirstChildWithName(EDITED);
+        DateTime dt = (DateTime)_getFirstChildWithName(EDITED);
         if (dt == null)
-            dt = (DateTime)getFirstChildWithName(PRE_RFC_EDITED);
+            dt = (DateTime)_getFirstChildWithName(PRE_RFC_EDITED);
         return dt;
     }
 
@@ -640,9 +640,9 @@ public class FOMEntry extends FOMExtensi
     }
 
     public Control getControl() {
-        Control control = (Control)getFirstChildWithName(CONTROL);
+        Control control = (Control)_getFirstChildWithName(CONTROL);
         if (control == null)
-            control = (Control)getFirstChildWithName(PRE_RFC_CONTROL);
+            control = (Control)_getFirstChildWithName(PRE_RFC_CONTROL);
         return control;
     }
 

Modified: webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMExtensibleElement.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMExtensibleElement.java?rev=1706530&r1=1706529&r2=1706530&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMExtensibleElement.java
(original)
+++ webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMExtensibleElement.java
Sat Oct  3 09:24:38 2015
@@ -47,7 +47,7 @@ public class FOMExtensibleElement extend
 
     public <T extends Element> T getExtension(QName qname) {
         FOMFactory factory = (FOMFactory)getFactory();
-        T t = (T)this.getFirstChildWithName(qname);
+        T t = (T)_getFirstChildWithName(qname);
         return (T)((t != null) ? factory.getElementWrapper(t) : null);
     }
 
@@ -144,7 +144,7 @@ public class FOMExtensibleElement extend
     }
 
     public <T extends Element> T addExtension(QName qname, QName before) {
-        OMElement el = getFirstChildWithName(before);
+        OMElement el = (OMElement)_getFirstChildWithName(before);
         T element = (T)getFactory().newElement(qname);
         if (el == null) {
             addExtension(element);

Modified: webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java?rev=1706530&r1=1706529&r2=1706530&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java
(original)
+++ webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java
Sat Oct  3 09:24:38 2015
@@ -48,7 +48,7 @@ public class FOMFeed extends FOMSource i
     }
 
     public Feed insertEntry(Entry entry) {
-        OMElement el = getFirstChildWithName(ENTRY);
+        OMElement el = (OMElement)_getFirstChildWithName(ENTRY);
         if (el == null) {
             addEntry(entry);
         } else {
@@ -83,7 +83,7 @@ public class FOMFeed extends FOMSource i
     @Override
     public void addChild(OMNode node) {
         if (isComplete() && node instanceof OMElement && !(node instanceof
Entry)) {
-            OMElement el = this.getFirstChildWithName(ENTRY);
+            OMElement el = (OMElement)_getFirstChildWithName(ENTRY);
             if (el != null) {
                 el.insertSiblingBefore(node);
                 return;

Modified: webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMPerson.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMPerson.java?rev=1706530&r1=1706529&r2=1706530&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMPerson.java
(original)
+++ webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMPerson.java
Sat Oct  3 09:24:38 2015
@@ -29,7 +29,7 @@ import org.apache.axiom.fom.AbderaPerson
 
 public class FOMPerson extends FOMExtensibleElement implements AbderaPerson {
     public Element getNameElement() {
-        return (Element)getFirstChildWithName(NAME);
+        return (Element)_getFirstChildWithName(NAME);
     }
 
     public Person setNameElement(Element element) {
@@ -55,7 +55,7 @@ public class FOMPerson extends FOMExtens
     }
 
     public Element getEmailElement() {
-        return (Element)getFirstChildWithName(EMAIL);
+        return (Element)_getFirstChildWithName(EMAIL);
     }
 
     public Person setEmailElement(Element element) {
@@ -81,7 +81,7 @@ public class FOMPerson extends FOMExtens
     }
 
     public IRIElement getUriElement() {
-        return (IRIElement)getFirstChildWithName(URI);
+        return (IRIElement)_getFirstChildWithName(URI);
     }
 
     public Person setUriElement(IRIElement uri) {

Modified: webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMSource.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMSource.java?rev=1706530&r1=1706529&r2=1706530&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMSource.java
(original)
+++ webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMSource.java
Sat Oct  3 09:24:38 2015
@@ -58,7 +58,7 @@ import org.apache.axiom.om.OMNode;
 @SuppressWarnings( {"unchecked", "deprecation"})
 public class FOMSource extends FOMExtensibleElement implements AbderaSource {
     public Person getAuthor() {
-        return (Person)getFirstChildWithName(AUTHOR);
+        return (Person)_getFirstChildWithName(AUTHOR);
     }
 
     public List<Person> getAuthors() {
@@ -113,7 +113,7 @@ public class FOMSource extends FOMExtens
     }
 
     public IRIElement getIdElement() {
-        return (IRIElement)getFirstChildWithName(ID);
+        return (IRIElement)_getFirstChildWithName(ID);
     }
 
     public <T extends Source> T setIdElement(IRIElement id) {
@@ -320,7 +320,7 @@ public class FOMSource extends FOMExtens
     }
 
     public DateTime getUpdatedElement() {
-        return (DateTime)getFirstChildWithName(UPDATED);
+        return (DateTime)_getFirstChildWithName(UPDATED);
     }
 
     public <T extends Source> T setUpdatedElement(DateTime updated) {
@@ -363,7 +363,7 @@ public class FOMSource extends FOMExtens
     }
 
     public Generator getGenerator() {
-        return (Generator)getFirstChildWithName(GENERATOR);
+        return (Generator)_getFirstChildWithName(GENERATOR);
     }
 
     public <T extends Source> T setGenerator(Generator generator) {
@@ -383,7 +383,7 @@ public class FOMSource extends FOMExtens
     }
 
     public IRIElement getIconElement() {
-        return (IRIElement)getFirstChildWithName(ICON);
+        return (IRIElement)_getFirstChildWithName(ICON);
     }
 
     public <T extends Source> T setIconElement(IRIElement iri) {
@@ -408,7 +408,7 @@ public class FOMSource extends FOMExtens
     }
 
     public IRIElement getLogoElement() {
-        return (IRIElement)getFirstChildWithName(LOGO);
+        return (IRIElement)_getFirstChildWithName(LOGO);
     }
 
     public <T extends Source> T setLogoElement(IRIElement iri) {

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=1706530&r1=1706529&r2=1706530&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
Sat Oct  3 09:24:38 2015
@@ -54,13 +54,13 @@ public class FOMText extends FOMElement
     }
 
     public Div getValueElement() {
-        return (Div)this.getFirstChildWithName(Constants.DIV);
+        return (Div)_getFirstChildWithName(Constants.DIV);
     }
 
     public Text setValueElement(Div value) {
         if (value != null) {
-            if (this.getFirstChildWithName(Constants.DIV) != null)
-                this.getFirstChildWithName(Constants.DIV).discard();
+            if (_getFirstChildWithName(Constants.DIV) != null)
+                _getFirstChildWithName(Constants.DIV).discard();
             setTextType(Text.Type.XHTML);
             removeChildren();
             addChild((OMElement)value);
@@ -76,7 +76,7 @@ public class FOMText extends FOMElement
         } else if (Type.HTML.equals(type)) {
             val = getText();
         } else if (Type.XHTML.equals(type)) {
-            FOMDiv div = (FOMDiv)this.getFirstChildWithName(Constants.DIV);
+            FOMDiv div = (FOMDiv)_getFirstChildWithName(Constants.DIV);
             val = (div != null) ? div.getInternalValue() : null;
         }
         return val;
@@ -128,7 +128,7 @@ public class FOMText extends FOMElement
 
     public String getWrappedValue() {
         if (Type.XHTML.equals(type)) {
-            return this.getFirstChildWithName(Constants.DIV).toString();
+            return _getFirstChildWithName(Constants.DIV).toString();
         } else {
             return getValue();
         }



Mime
View raw message