ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1484074 - in /webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/serializer/pull: AbstractWrapper.java SwitchingWrapper.java
Date Sat, 18 May 2013 09:14:30 GMT
Author: veithen
Date: Sat May 18 09:14:29 2013
New Revision: 1484074

URL: http://svn.apache.org/r1484074
Log:
* Reduce method visibility.
* Use final where appropriate.
* Removed dead code.

Modified:
    webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/serializer/pull/AbstractWrapper.java
    webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/serializer/pull/SwitchingWrapper.java

Modified: webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/serializer/pull/AbstractWrapper.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/serializer/pull/AbstractWrapper.java?rev=1484074&r1=1484073&r2=1484074&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/serializer/pull/AbstractWrapper.java
(original)
+++ webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/serializer/pull/AbstractWrapper.java
Sat May 18 09:14:29 2013
@@ -32,7 +32,6 @@ import org.apache.axiom.util.stax.XMLStr
  * Base class for {@link PullSerializerState} implementations that wrap an {@link XMLStreamReader}.
  */
 //TODO: what about the close() method?
-// TODO: make methods final
 abstract class AbstractWrapper extends PullSerializerState {
     protected final XMLStreamReader reader;
     private final PullSerializer serializer;
@@ -83,15 +82,15 @@ abstract class AbstractWrapper extends P
         return dataHandlerReader;
     }
 
-    int getEventType() {
+    final int getEventType() {
         return reader.getEventType();
     }
 
-    boolean hasNext() throws XMLStreamException {
+    final boolean hasNext() throws XMLStreamException {
         return reader.hasNext();
     }
 
-    int next() throws XMLStreamException {
+    final int next() throws XMLStreamException {
         if (depth == 0) {
             // We get here if the underlying XMLStreamReader is on the last END_ELEMENT event
             // TODO: also do this if the reader is prematurely closed
@@ -112,7 +111,7 @@ abstract class AbstractWrapper extends P
         }
     }
     
-    int nextTag() throws XMLStreamException {
+    final int nextTag() throws XMLStreamException {
         // TODO: need to handle depth == 0 case here!
         int result = reader.nextTag();
         switch (result) {
@@ -125,144 +124,144 @@ abstract class AbstractWrapper extends P
         return result;
     }
 
-    void close() throws XMLStreamException {
+    final void close() throws XMLStreamException {
         reader.close();
     }
 
-    Object getProperty(String name) throws IllegalArgumentException {
+    final Object getProperty(String name) throws IllegalArgumentException {
         return reader.getProperty(name);
     }
 
-    String getVersion() {
+    final String getVersion() {
         return reader.getVersion();
     }
 
-    String getCharacterEncodingScheme() {
+    final String getCharacterEncodingScheme() {
         return reader.getCharacterEncodingScheme();
     }
 
-    String getEncoding() {
+    final String getEncoding() {
         return reader.getEncoding();
     }
 
-    boolean isStandalone() {
+    final boolean isStandalone() {
         return reader.isStandalone();
     }
 
-    boolean standaloneSet() {
+    final boolean standaloneSet() {
         return reader.standaloneSet();
     }
 
-    String getPrefix() {
+    final String getPrefix() {
         return reader.getPrefix();
     }
 
-    String getNamespaceURI() {
+    final String getNamespaceURI() {
         return reader.getNamespaceURI();
     }
 
-    String getLocalName() {
+    final String getLocalName() {
         return reader.getLocalName();
     }
 
-    QName getName() {
+    final QName getName() {
         return reader.getName();
     }
 
-    int getNamespaceCount() {
+    final int getNamespaceCount() {
         return reader.getNamespaceCount();
     }
 
-    String getNamespacePrefix(int index) {
+    final String getNamespacePrefix(int index) {
         return reader.getNamespacePrefix(index);
     }
 
-    String getNamespaceURI(int index) {
+    final String getNamespaceURI(int index) {
         return reader.getNamespaceURI(index);
     }
 
-    int getAttributeCount() {
+    final int getAttributeCount() {
         return reader.getAttributeCount();
     }
 
-    String getAttributePrefix(int index) {
+    final String getAttributePrefix(int index) {
         return reader.getAttributePrefix(index);
     }
 
-    String getAttributeNamespace(int index) {
+    final String getAttributeNamespace(int index) {
         return reader.getAttributeNamespace(index);
     }
 
-    String getAttributeLocalName(int index) {
+    final String getAttributeLocalName(int index) {
         return reader.getAttributeLocalName(index);
     }
 
-    QName getAttributeName(int index) {
+    final QName getAttributeName(int index) {
         return reader.getAttributeName(index);
     }
 
-    boolean isAttributeSpecified(int index) {
+    final boolean isAttributeSpecified(int index) {
         return reader.isAttributeSpecified(index);
     }
 
-    String getAttributeType(int index) {
+    final String getAttributeType(int index) {
         return reader.getAttributeType(index);
     }
 
-    String getAttributeValue(int index) {
+    final String getAttributeValue(int index) {
         return reader.getAttributeValue(index);
     }
 
-    String getAttributeValue(String namespaceURI, String localName) {
+    final String getAttributeValue(String namespaceURI, String localName) {
         return reader.getAttributeValue(namespaceURI, localName);
     }
 
-    NamespaceContext getNamespaceContext() {
+    final NamespaceContext getNamespaceContext() {
         return reader.getNamespaceContext();
     }
 
-    String getNamespaceURI(String prefix) {
+    final String getNamespaceURI(String prefix) {
         return reader.getNamespaceURI(prefix);
     }
 
-    String getElementText() throws XMLStreamException {
+    final String getElementText() throws XMLStreamException {
         return reader.getElementText();
     }
 
-    String getText() {
+    final String getText() {
         return reader.getText();
     }
 
-    char[] getTextCharacters() {
+    final char[] getTextCharacters() {
         return reader.getTextCharacters();
     }
 
-    int getTextStart() {
+    final int getTextStart() {
         return reader.getTextStart();
     }
 
-    int getTextLength() {
+    final int getTextLength() {
         return reader.getTextLength();
     }
 
-    int getTextCharacters(int sourceStart, char[] target, int targetStart, int length)
+    final int getTextCharacters(int sourceStart, char[] target, int targetStart, int length)
             throws XMLStreamException {
         return reader.getTextCharacters(sourceStart, target, targetStart, length);
     }
 
-    Boolean isWhiteSpace() {
+    final Boolean isWhiteSpace() {
         return Boolean.valueOf(reader.isWhiteSpace());
     }
 
-    String getPIData() {
+    final String getPIData() {
         return reader.getPIData();
     }
 
-    String getPITarget() {
+    final String getPITarget() {
         return reader.getPITarget();
     }
 
-    OMDataSource getDataSource() {
+    final OMDataSource getDataSource() {
         return null;
     }
 

Modified: webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/serializer/pull/SwitchingWrapper.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/serializer/pull/SwitchingWrapper.java?rev=1484074&r1=1484073&r2=1484074&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/serializer/pull/SwitchingWrapper.java
(original)
+++ webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/serializer/pull/SwitchingWrapper.java
Sat May 18 09:14:29 2013
@@ -66,7 +66,7 @@ import org.apache.commons.logging.LogFac
 /**
  * Class used internally by {@link OMXMLStreamReaderExAdapter}.
  */
-class SwitchingWrapper extends PullSerializerState
+final class SwitchingWrapper extends PullSerializerState
     implements DataHandlerReader, CharacterDataReader, DTDReader, XMLStreamConstants {
     
     private static final Log log = LogFactory.getLog(SwitchingWrapper.class);
@@ -159,7 +159,7 @@ class SwitchingWrapper extends PullSeria
      * @param cache
      * @param preserveNamespaceContext
      */
-    public SwitchingWrapper(PullSerializer serializer, OMXMLParserWrapper builder, OMContainer
startNode,
+    SwitchingWrapper(PullSerializer serializer, OMXMLParserWrapper builder, OMContainer startNode,
                             boolean cache, boolean preserveNamespaceContext) {
         this.serializer = serializer;
         this.builder = builder;
@@ -184,7 +184,7 @@ class SwitchingWrapper extends PullSeria
         return this;
     }
 
-    public String getPrefix() {
+    String getPrefix() {
         if (parser != null && currentEvent != END_DOCUMENT) {
             return parser.getPrefix();
         } else {
@@ -197,7 +197,7 @@ class SwitchingWrapper extends PullSeria
         }
     }
 
-    public String getNamespaceURI() {
+    String getNamespaceURI() {
         if (parser != null && currentEvent != END_DOCUMENT) {
             return parser.getNamespaceURI();
         } else {
@@ -210,16 +210,7 @@ class SwitchingWrapper extends PullSeria
         }
     }
 
-    public boolean hasName() {
-        if (parser != null && currentEvent != END_DOCUMENT) {
-            return parser.hasName();
-        } else {
-            return ((currentEvent == START_ELEMENT)
-                    || (currentEvent == END_ELEMENT));
-        }
-    }
-
-    public String getLocalName() {
+    String getLocalName() {
         if (parser != null && currentEvent != END_DOCUMENT) {
             return parser.getLocalName();
         } else {
@@ -235,7 +226,7 @@ class SwitchingWrapper extends PullSeria
         }
     }
 
-    public QName getName() {
+    QName getName() {
         if (parser != null && currentEvent != END_DOCUMENT) {
             return parser.getName();
         } else {
@@ -256,7 +247,7 @@ class SwitchingWrapper extends PullSeria
         }
     }
 
-    public int getTextLength() {
+    int getTextLength() {
         if (parser != null) {
             return parser.getTextLength();
         } else {
@@ -264,7 +255,7 @@ class SwitchingWrapper extends PullSeria
         }
     }
 
-    public int getTextStart() {
+    int getTextStart() {
         if (parser != null) {
             return parser.getTextStart();
         } else {
@@ -284,7 +275,7 @@ class SwitchingWrapper extends PullSeria
         }
     }
 
-    public int getTextCharacters(int sourceStart, char[] target, int targetStart, int length)
+    int getTextCharacters(int sourceStart, char[] target, int targetStart, int length)
             throws XMLStreamException {
         if (parser != null) {
             return parser.getTextCharacters(sourceStart, target, targetStart, length);
@@ -296,7 +287,7 @@ class SwitchingWrapper extends PullSeria
         }
     }
 
-    public char[] getTextCharacters() {
+    char[] getTextCharacters() {
         if (parser != null) {
             return parser.getTextCharacters();
         } else {
@@ -304,7 +295,7 @@ class SwitchingWrapper extends PullSeria
         }
     }
 
-    public String getText() {
+    String getText() {
         if (parser != null) {
             return parser.getText();
         } else {
@@ -370,7 +361,7 @@ class SwitchingWrapper extends PullSeria
     }
 
     // todo this should be improved
-    public int getEventType() {
+    int getEventType() {
         return currentEvent;
     }
 
@@ -445,7 +436,7 @@ class SwitchingWrapper extends PullSeria
         }
     }
     
-    public String getNamespaceURI(int i) {
+    String getNamespaceURI(int i) {
         if (parser != null) {
             String uri = parser.getNamespaceURI(i);
 
@@ -471,7 +462,7 @@ class SwitchingWrapper extends PullSeria
         }
     }
 
-    public String getNamespacePrefix(int i) {
+    String getNamespacePrefix(int i) {
         if (parser != null) {
             return parser.getNamespacePrefix(i);
         } else {
@@ -484,7 +475,7 @@ class SwitchingWrapper extends PullSeria
         }
     }
 
-    public int getNamespaceCount() {
+    int getNamespaceCount() {
         if (parser != null && currentEvent != END_DOCUMENT) {
             return parser.getNamespaceCount();
         } else {
@@ -497,7 +488,7 @@ class SwitchingWrapper extends PullSeria
         }
     }
 
-    public boolean isAttributeSpecified(int i) {
+    boolean isAttributeSpecified(int i) {
         if (parser != null) {
             return parser.isAttributeSpecified(i);
         } else {
@@ -512,7 +503,7 @@ class SwitchingWrapper extends PullSeria
         }
     }
 
-    public String getAttributeValue(int i) {
+    String getAttributeValue(int i) {
         if (parser != null) {
             return parser.getAttributeValue(i);
         } else {
@@ -525,7 +516,7 @@ class SwitchingWrapper extends PullSeria
         }
     }
 
-    public String getAttributeType(int i) {
+    String getAttributeType(int i) {
         if (parser != null) {
             return parser.getAttributeType(i);
         } else {
@@ -538,7 +529,7 @@ class SwitchingWrapper extends PullSeria
         }
     }
 
-    public String getAttributePrefix(int i) {
+    String getAttributePrefix(int i) {
         if (parser != null) {
             return parser.getAttributePrefix(i);
         } else {
@@ -551,7 +542,7 @@ class SwitchingWrapper extends PullSeria
         }
     }
 
-    public String getAttributeLocalName(int i) {
+    String getAttributeLocalName(int i) {
         if (parser != null) {
             return parser.getAttributeLocalName(i);
         } else {
@@ -564,7 +555,7 @@ class SwitchingWrapper extends PullSeria
         }
     }
 
-    public String getAttributeNamespace(int i) {
+    String getAttributeNamespace(int i) {
         if (parser != null) {
             return parser.getAttributeNamespace(i);
         } else {
@@ -577,7 +568,7 @@ class SwitchingWrapper extends PullSeria
         }
     }
 
-    public QName getAttributeName(int i) {
+    QName getAttributeName(int i) {
         if (parser != null) {
             return parser.getAttributeName(i);
         } else {
@@ -590,7 +581,7 @@ class SwitchingWrapper extends PullSeria
         }
     }
 
-    public int getAttributeCount() {
+    int getAttributeCount() {
         int returnCount = 0;
         if (parser != null) {
             returnCount = parser.getAttributeCount();
@@ -607,7 +598,7 @@ class SwitchingWrapper extends PullSeria
         return returnCount;
     }
 
-    public String getAttributeValue(String s, String s1) {
+    String getAttributeValue(String s, String s1) {
         String returnString = null;
         if (parser != null) {
             returnString = parser.getAttributeValue(s, s1);
@@ -630,7 +621,7 @@ class SwitchingWrapper extends PullSeria
         return null;
     }
 
-    public String getNamespaceURI(String prefix) {
+    String getNamespaceURI(String prefix) {
         String returnString = null;
         if (parser != null) {
             returnString = parser.getNamespaceURI(prefix);
@@ -647,7 +638,7 @@ class SwitchingWrapper extends PullSeria
         return returnString;
     }
 
-    public void close() throws XMLStreamException {
+    void close() throws XMLStreamException {
         try {
             // If there is a builder, it controls its parser
             if (builder != null && builder instanceof StAXBuilder) {
@@ -666,11 +657,11 @@ class SwitchingWrapper extends PullSeria
         }
     }
 
-    public boolean hasNext() throws XMLStreamException {
+    boolean hasNext() throws XMLStreamException {
         return currentEvent != END_DOCUMENT;
     }
 
-    public String getElementText() throws XMLStreamException {
+    String getElementText() throws XMLStreamException {
         // Let StreamSwitch handle this method
         return null;
     }
@@ -724,7 +715,7 @@ class SwitchingWrapper extends PullSeria
         }
     }
 
-    public int next() throws XMLStreamException {
+    int next() throws XMLStreamException {
         switch (state) {
             case DOCUMENT_COMPLETE:
                 throw new NoSuchElementException("End of the document reached");
@@ -817,12 +808,12 @@ class SwitchingWrapper extends PullSeria
         return currentEvent;
     }
 
-    public int nextTag() throws XMLStreamException {
+    int nextTag() throws XMLStreamException {
         // Let StreamSwitch handle this method
         return -1;
     }
 
-    public Object getProperty(String s) throws IllegalArgumentException {
+    Object getProperty(String s) throws IllegalArgumentException {
         Object value = XMLStreamReaderUtils.processGetProperty(this, s);
         if (value != null) {
             return value;
@@ -866,7 +857,7 @@ class SwitchingWrapper extends PullSeria
         }
     }
 
-    public NamespaceContext getNamespaceContext() {
+    NamespaceContext getNamespaceContext() {
         if (parser != null) {
             return currentEvent == END_DOCUMENT ? new MapBasedNamespaceContext(Collections.EMPTY_MAP)
: parser.getNamespaceContext();
         } else {
@@ -875,7 +866,7 @@ class SwitchingWrapper extends PullSeria
         }
     }
 
-    public String getEncoding() {
+    String getEncoding() {
         if (parser != null) {
             return parser.getEncoding();
         } else {
@@ -891,19 +882,19 @@ class SwitchingWrapper extends PullSeria
         }
     }
 
-    public String getVersion() {
+    String getVersion() {
         return "1.0"; // todo put the constant
     }
 
-    public boolean isStandalone() {
+    boolean isStandalone() {
         return true;
     }
 
-    public boolean standaloneSet() {
+    boolean standaloneSet() {
         return false;
     }
 
-    public String getCharacterEncodingScheme() {
+    String getCharacterEncodingScheme() {
         if (parser != null) {
             return parser.getCharacterEncodingScheme();
         } else {
@@ -919,7 +910,7 @@ class SwitchingWrapper extends PullSeria
         }
     }
 
-    public String getPITarget() {
+    String getPITarget() {
         if (parser != null) {
             return parser.getPITarget();
         } else {
@@ -931,7 +922,7 @@ class SwitchingWrapper extends PullSeria
         }
     }
 
-    public String getPIData() {
+    String getPIData() {
         if (parser != null) {
             return parser.getPIData();
         } else {



Mime
View raw message