[jdom-interest] Visibility patch: org.jdom

Jason Hunter jhunter at acm.org
Tue May 27 11:50:12 PDT 2003


I just went through the org.jdom classes (the other packages will come 
next) changing visibility as I believe we should have it for 1.0.  When 
in doubt, I erred on the side of less visibility under the mantra that 
it's easier to add things after 1.0 than take them away.

I'm sending the patch around for a little review.  If you want, you can 
even apply the patch and see if any of your extensions break.  :-) 
If/when we find breakages, we'll look at making things more public or 
finding alternate ways to accomplish the task.

Here's the basic strategy I took in org.jdom:

* The core features of the Child classes are left protected.  Things 
like names, namespaces, parent, and so on.  The setParent() call is also 
protected as it has been.

* I made the various custom exception constructors package protected 
with just a single public version that takes a String.  Our multi-param 
constructor signatures are conveniences that I don't think should be 
public.  Package protected works fine since the checks always happen in 
the org.jdom package.  The downside is third party extensions will have 
to do a little string work if they want to throw an exception, but the 
String constructor will work fine.

* I made package protected the references to AttributeList and 
ContentList.  Subclasses that must use their own variables if they want 
an alternate way for tracking lists of content.

* I exposed as protected the baseURI variable in Document, since it's 
kind of a core feature.  This violates my encapsulation sensibilities, 
but it seems appropriate for subclassing.

* I made private the cause property of JDOMException.  No one should be 
tweaking this.

* On Verifier I made the checkXXX() methods public and the supporting 
isXXX() methods private.  Seems like a natural line in the sand.  I 
could easily leave them all public if people can say why the isXXX() 
calls would be publicly useful somehow.  This breaks the Verifier tests 
which test the isXXX() methods.  How do JUnit folks recommend testing 
private utility methods?

* For package protected classes I made the method visibility package 
protected also wherever legal (they have to be public if they implement 
a public interface).  I don't think this has any real effect, but it 
seems more sensible.  If you know differently, let me know.

I think that's it.  The patch tells all.

-jh-
-------------- next part --------------
Index: AttributeList.java
===================================================================
RCS file: /home/cvs/jdom/src/java/org/jdom/AttributeList.java,v
retrieving revision 1.16
diff -u -r1.16 AttributeList.java
--- AttributeList.java	18 Apr 2003 04:04:11 -0000	1.16
+++ AttributeList.java	27 May 2003 19:12:23 -0000
@@ -85,7 +85,7 @@
     private int size;
 
     /** The parent Element */
-    protected Element parent;
+    private Element parent;
 
     /** Force an Element parent */
     private AttributeList() {}
@@ -94,7 +94,7 @@
      * Create a new instance of the AttributeList representing
      * Element content
      */
-    public AttributeList(Element parent) {
+    AttributeList(Element parent) {
         this.parent = parent;
     }
 
@@ -164,7 +164,7 @@
      * @param index index where to add <code>Attribute</code>
      * @param attribute <code>Attribute</code> to add
      */
-    protected void add(int index, Attribute attribute) {
+    void add(int index, Attribute attribute) {
         if (attribute.getParent() != null) {
             throw new IllegalAddException(
                           "The attribute already has an existing parent \"" +
@@ -267,7 +267,7 @@
      *
      * @param collection The collection to use.
      */
-    public void clearAndSet(Collection collection) {
+    void clearAndSet(Collection collection) {
         Attribute[] old = elementData;
         int oldSize = size;
 
@@ -302,7 +302,7 @@
      *
      * @param minCapacity the desired minimum capacity.
      */
-    protected void ensureCapacity(int minCapacity) {
+    private void ensureCapacity(int minCapacity) {
         if (elementData == null) {
             elementData = new Attribute[minCapacity];
         }
@@ -341,7 +341,7 @@
      * @param namespace <code>Namespace</code> to match
      * @return the <code>Attribute</code>, or null if one doesn't exist.
      */
-    protected Object get(String name, Namespace namespace) {
+    Object get(String name, Namespace namespace) {
         int index = indexOf(name, namespace);
         if (index < 0) {
             return null;
@@ -353,7 +353,7 @@
      * Return index of the <code>Attribute</code> with the
      * given name and uri.
      */
-    protected int indexOf(String name, Namespace namespace) {
+    int indexOf(String name, Namespace namespace) {
         String uri = namespace.getURI();
         if (elementData != null) {
             for (int i = 0; i < size; i++) {
@@ -397,7 +397,7 @@
      * @return the <code>true</code> if attribute was removed,
      *             <code>false</code> otherwise
      */
-    protected boolean remove(String name, Namespace namespace) {
+    boolean remove(String name, Namespace namespace) {
         int index = indexOf(name, namespace);
         if (index < 0) {
             return false;
@@ -443,7 +443,7 @@
      * @return The object which was replaced.
      * throws IndexOutOfBoundsException if index < 0 || index >= size()
      */
-    protected Object set(int index, Attribute attribute) {
+    Object set(int index, Attribute attribute) {
         if (index < 0 || index >= size)
             throw new IndexOutOfBoundsException("Index: " + index +
                                                 " Size: " + size());
Index: CDATA.java
===================================================================
RCS file: /home/cvs/jdom/src/java/org/jdom/CDATA.java,v
retrieving revision 1.27
diff -u -r1.27 CDATA.java
--- CDATA.java	30 Apr 2003 09:55:11 -0000	1.27
+++ CDATA.java	27 May 2003 19:12:23 -0000
@@ -74,8 +74,6 @@
     private static final String CVS_ID = 
       "@(#) $RCSfile: CDATA.java,v $ $Revision: 1.27 $ $Date: 2003/04/30 09:55:11 $ $Name:  $";
 
-    private static final String EMPTY_STRING = "";
-
     /**
      * This is the protected, no-args constructor standard in all JDOM
      * classes. It allows subclassers to get a raw instance with no
Index: ContentList.java
===================================================================
RCS file: /home/cvs/jdom/src/java/org/jdom/ContentList.java,v
retrieving revision 1.25
diff -u -r1.25 ContentList.java
--- ContentList.java	20 May 2003 21:53:59 -0000	1.25
+++ ContentList.java	27 May 2003 19:12:27 -0000
@@ -103,7 +103,7 @@
     private int size;
 
     /** Document or Element this list belongs to */
-    protected Object parent;
+    private Object parent;
 
     /** Force either a Document or Element parent */
     private ContentList() { }
@@ -112,7 +112,7 @@
      * Create a new instance of the ContentList representing
      * Document content
      */
-    protected ContentList(Document document) {
+    ContentList(Document document) {
         this.parent = document;
     }
 
@@ -120,7 +120,7 @@
      * Create a new instance of the ContentList representing
      * Element content
      */
-    protected ContentList(Element parent) {
+    ContentList(Element parent) {
         this.parent = parent;
     }
 
@@ -171,7 +171,7 @@
      * @param index index where to add <code>Element</code>
      * @param element <code>Element</code> to add
      */
-    protected void add(int index, Element element) {
+    void add(int index, Element element) {
         if (element == null) {
             throw new IllegalAddException("Cannot add null object");
         }
@@ -236,7 +236,7 @@
      * @param index index where to add <code>Element</code>
      * @param doctype <code>DocType</code> to add
      */
-    protected void add(int index, DocType doctype) {
+    void add(int index, DocType doctype) {
         if (doctype == null) {
             throw new IllegalAddException("Cannot add null object");
         }
@@ -289,7 +289,7 @@
      * @param index index where to add <code>Comment</code>
      * @param comment <code>Comment</code> to add
      */
-    protected void add(int index, Comment comment) {
+    void add(int index, Comment comment) {
         if (comment == null) {
             throw new IllegalAddException("Cannot add null object");
         }
@@ -336,7 +336,7 @@
      * @param index index where to add <code>ProcessingInstruction</code>
      * @param pi <code>ProcessingInstruction</code> to add
      */
-    protected void add(int index, ProcessingInstruction pi) {
+    void add(int index, ProcessingInstruction pi) {
         if (pi == null) {
             throw new IllegalAddException("Cannot add null object");
         }
@@ -383,7 +383,7 @@
      * @param index index where to add <code>CDATA</code>
      * @param cdata <code>CDATA</code> to add
      */
-    protected void add(int index, CDATA cdata) {
+    void add(int index, CDATA cdata) {
         if (cdata == null) {
             throw new IllegalAddException("Cannot add null object");
         }
@@ -424,7 +424,7 @@
      * @param index index where to add <code>Text</code>
      * @param text <code>Text</code> to add
      */
-    protected void add(int index, Text text) {
+    void add(int index, Text text) {
         if (text == null) {
             throw new IllegalAddException("Cannot add null object");
         }
@@ -465,7 +465,7 @@
      * @param index index where to add <code>Entity</code>
      * @param entity <code>Entity</code> to add
      */
-    protected void add(int index, EntityRef entity) {
+    void add(int index, EntityRef entity) {
         if (entity == null) {
             throw new IllegalAddException("Cannot add null object");
         }
@@ -572,7 +572,7 @@
      *
      * @param collection The collection to use.
      */
-    protected void clearAndSet(Collection collection) {
+    void clearAndSet(Collection collection) {
         Object[] old = elementData;
         int oldSize = size;
 
@@ -606,7 +606,7 @@
      *
      * @param minCapacity the desired minimum capacity.
      */
-    protected void ensureCapacity(int minCapacity) {
+    void ensureCapacity(int minCapacity) {
         if( elementData==null ) {
             elementData = new Object[INITIAL_ARRAY_SIZE];
         } else {
@@ -642,7 +642,7 @@
      * @param filter <code>Filter</code> for this view.
      * @return a list representing the rules of the <code>Filter</code>.
      */
-    protected List getView(Filter filter) {
+    List getView(Filter filter) {
         return new FilterList(filter);
     }
 
@@ -653,7 +653,7 @@
      *
      * @return index of first element, or -1 if one doesn't exist
      */
-    protected int indexOfFirstElement() {
+    int indexOfFirstElement() {
         if( elementData!=null ) {
             for (int i = 0; i < size; i++) {
                 if (elementData[i] instanceof Element) {
@@ -671,7 +671,7 @@
      * @return                     index of the DocType, or -1 if it doesn't
      *                             exist
      */
-    protected int indexOfDocType() {
+    int indexOfDocType() {
         if (elementData != null) {
             for (int i = 0; i < size; i++) {
                 if (elementData[i] instanceof DocType) {
@@ -811,7 +811,7 @@
     class FilterList extends AbstractList {
 
         /** The Filter */
-        protected Filter filter;
+        Filter filter;
 
         /** Current number of items in this view */
         int count = 0;
Index: DescendantIterator.java
===================================================================
RCS file: /home/cvs/jdom/src/java/org/jdom/DescendantIterator.java,v
retrieving revision 1.1
diff -u -r1.1 DescendantIterator.java
--- DescendantIterator.java	21 May 2003 09:17:44 -0000	1.1
+++ DescendantIterator.java	27 May 2003 19:12:28 -0000
@@ -78,7 +78,7 @@
     /**
      * Iterator for the descendants of the supplied object.
      */
-    public DescendantIterator(Parent parent) {
+    DescendantIterator(Parent parent) {
         if (parent == null) {
             throw new IllegalArgumentException("parent parameter was null");
         }
Index: Document.java
===================================================================
RCS file: /home/cvs/jdom/src/java/org/jdom/Document.java,v
retrieving revision 1.69
diff -u -r1.69 Document.java
--- Document.java	23 May 2003 21:59:28 -0000	1.69
+++ Document.java	27 May 2003 19:12:29 -0000
@@ -75,16 +75,16 @@
       "@(#) $RCSfile: Document.java,v $ $Revision: 1.69 $ $Date: 2003/05/23 21:59:28 $ $Name:  $";
 
     /**
-     * This <code>Document</code>'s
-     * <code>{@link Comment}</code>s,
-     * <code>{@link ProcessingInstruction}</code>s and
-     * the root <code>{@link Element}</code>.
+     * This document's content including comments, PIs, a possible
+     * DocType, and a root element.
+     * Subclassers have to track content using their own
+     * mechanism.
      */
-    protected ContentList content = new ContentList(this);
+    ContentList content = new ContentList(this);
 
     // See http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/
     //                                     core.html#baseURIs-Considerations
-    private String baseURI = null;
+    protected String baseURI = null;
 
     /**
      * Creates a new empty document.  A document must have a root element,
@@ -172,22 +172,22 @@
         return content.indexOf(child);
     }
 
-    /**
-     * Starting at the given index (inclusive), return the index of
-     * the first child matching the supplied filter, or -1
-     * if none is found.
-     *
-     * @return index of child, or -1 if none found.
-     */
-    private int childIndex(int start, Filter filter) {
-        int size = getChildCount();
-        for (int i = start; i < size; i++) {
-            if (filter.matches(getContent(i))) {
-                return i;
-            }
-        }
-        return -1;
-    }
+//    /**
+//     * Starting at the given index (inclusive), return the index of
+//     * the first child matching the supplied filter, or -1
+//     * if none is found.
+//     *
+//     * @return index of child, or -1 if none found.
+//     */
+//    private int childIndex(int start, Filter filter) {
+//        int size = getChildCount();
+//        for (int i = start; i < size; i++) {
+//            if (filter.matches(getContent(i))) {
+//                return i;
+//            }
+//        }
+//        return -1;
+//    }
 
     /**
      * This will return <code>true</code> if this document has a
Index: Element.java
===================================================================
RCS file: /home/cvs/jdom/src/java/org/jdom/Element.java,v
retrieving revision 1.136
diff -u -r1.136 Element.java
--- Element.java	21 May 2003 09:17:45 -0000	1.136
+++ Element.java	27 May 2003 19:12:36 -0000
@@ -101,11 +101,17 @@
     /** Parent or null if none */
     protected Parent parent;
 
-    /** The attributes of the element */
-    protected AttributeList attributes = new AttributeList(this);
+    /**
+     *  The attributes of the element.  Subclassers have to
+     * track attributes using their own mechanism.
+     */
+    AttributeList attributes = new AttributeList(this);
 
-    /** The mixed content of the element */
-    protected ContentList content = new ContentList(this);
+    /**
+     * The content of the element.  Subclassers have to
+     * track content using their own mechanism.
+     */
+    ContentList content = new ContentList(this);
 
     /**
      * This protected constructor is provided in order to support an Element
@@ -458,15 +464,15 @@
         return content.indexOf(child);
     }
 
-    private int childIndex(int start, Filter filter) {
-        int size = getChildCount();
-        for (int i = start; i < size; i++) {
-            if (filter.matches(getContent(i))) {
-                return i;
-            }
-        }
-        return -1;
-    }
+//    private int childIndex(int start, Filter filter) {
+//        int size = getChildCount();
+//        for (int i = start; i < size; i++) {
+//            if (filter.matches(getContent(i))) {
+//                return i;
+//            }
+//        }
+//        return -1;
+//    }
 
     /**
      * Returns the owning document for this element, or null if it's not a
Index: FilterIterator.java
===================================================================
RCS file: /home/cvs/jdom/src/java/org/jdom/FilterIterator.java,v
retrieving revision 1.1
diff -u -r1.1 FilterIterator.java
--- FilterIterator.java	21 May 2003 09:17:45 -0000	1.1
+++ FilterIterator.java	27 May 2003 19:12:37 -0000
@@ -72,9 +72,6 @@
     private Filter filter;
     private Object nextObject;
 
-    protected FilterIterator() {
-    }
-
     public FilterIterator(Iterator iterator, Filter filter) {
         if ((iterator == null) || (filter == null)) {
             throw new IllegalArgumentException("null parameter");
Index: IllegalAddException.java
===================================================================
RCS file: /home/cvs/jdom/src/java/org/jdom/IllegalAddException.java,v
retrieving revision 1.22
diff -u -r1.22 IllegalAddException.java
--- IllegalAddException.java	30 Apr 2003 09:55:12 -0000	1.22
+++ IllegalAddException.java	27 May 2003 19:12:37 -0000
@@ -78,7 +78,7 @@
      * @param added <code>Attribute</code> that could not be added
      * @param reason cause of the problem
      */
-    public IllegalAddException(Element base, Attribute added, String reason) {
+    IllegalAddException(Element base, Attribute added, String reason) {
         super(new StringBuffer()
               .append("The attribute \"")
               .append(added.getQualifiedName())
@@ -99,7 +99,7 @@
      * @param added <code>Element</code> that could not be added
      * @param reason cause of the problem
      */
-    public IllegalAddException(Element base, Element added, String reason) {
+    IllegalAddException(Element base, Element added, String reason) {
         super(new StringBuffer()
               .append("The element \"")
               .append(added.getQualifiedName())
@@ -120,7 +120,7 @@
      * @param added <code>Element</code> that could not be added
      * @param reason cause of the problem
      */
-    public IllegalAddException(Document base, Element added, String reason) {
+    IllegalAddException(Document base, Element added, String reason) {
         super(new StringBuffer()
               .append("The element \"")
               .append(added.getQualifiedName())
@@ -139,7 +139,7 @@
      * @param added <code>ProcessingInstruction</code> that could not be added
      * @param reason cause of the problem
      */
-    public IllegalAddException(Element base, ProcessingInstruction added,
+    IllegalAddException(Element base, ProcessingInstruction added,
                                String reason) {
         super(new StringBuffer()
               .append("The PI \"")
@@ -161,7 +161,7 @@
      * @param added <code>ProcessingInstruction</code> that could not be added
      * @param reason cause of the problem
      */
-    public IllegalAddException(Document base, ProcessingInstruction added,
+    IllegalAddException(Document base, ProcessingInstruction added,
                                String reason) {
         super(new StringBuffer()
               .append("The PI \"")
@@ -181,7 +181,7 @@
      * @param added <code>Comment</code> that could not be added
      * @param reason cause of the problem
      */
-    public IllegalAddException(Element base, Comment added, String reason) {
+    IllegalAddException(Element base, Comment added, String reason) {
         super(new StringBuffer()
               .append("The comment \"")
               .append(added.getText())
@@ -202,7 +202,7 @@
      * @param added <code>CDATA</code> that could not be added
      * @param reason cause of the problem
      */
-    public IllegalAddException(Element base, CDATA added, String reason) {
+    IllegalAddException(Element base, CDATA added, String reason) {
         super(new StringBuffer()
               .append("The CDATA \"")
               .append(added.getText())
@@ -224,7 +224,7 @@
      * @param added <code>Text</code> that could not be added
      * @param reason cause of the problem
      */
-    public IllegalAddException(Element base, Text added, String reason) {
+    IllegalAddException(Element base, Text added, String reason) {
         super(new StringBuffer()
               .append("The Text \"")
               .append(added.getText())
@@ -245,7 +245,7 @@
      * @param added <code>Comment</code> that could not be added
      * @param reason cause of the problem
      */
-    public IllegalAddException(Document base, Comment added, String reason) {
+    IllegalAddException(Document base, Comment added, String reason) {
         super(new StringBuffer()
               .append("The comment \"")
               .append(added.getText())
@@ -264,7 +264,7 @@
      * @param added <code>EntityRef</code> reference that could not be added
      * @param reason cause of the problem
      */
-    public IllegalAddException(Element base, EntityRef added, String reason) {
+    IllegalAddException(Element base, EntityRef added, String reason) {
         super(new StringBuffer()
               .append("The entity reference\"")
               .append(added.getName())
@@ -285,7 +285,7 @@
      * @param added <code>Namespace</code> that could not be added
      * @param reason cause of the problem
      */
-    public IllegalAddException(Element base, Namespace added, String reason) {
+    IllegalAddException(Element base, Namespace added, String reason) {
         super(new StringBuffer()
               .append("The namespace xmlns")
               .append((added.getPrefix() == null ||
@@ -310,7 +310,7 @@
      * @param added <code>DocType</code> that could not be added
      * @param reason cause of the problem
      */
-    public IllegalAddException(Document base, DocType added, String reason) {
+    IllegalAddException(Document base, DocType added, String reason) {
         super(new StringBuffer()
               .append("The DOCTYPE ")
               .append(added.toString())
Index: IllegalDataException.java
===================================================================
RCS file: /home/cvs/jdom/src/java/org/jdom/IllegalDataException.java,v
retrieving revision 1.11
diff -u -r1.11 IllegalDataException.java
--- IllegalDataException.java	30 Apr 2003 09:55:12 -0000	1.11
+++ IllegalDataException.java	27 May 2003 19:12:38 -0000
@@ -77,7 +77,7 @@
      * @param construct <code>String</code> construct that data is illegal for.
      * @param reason <code>String</code> message or reason data is illegal.
      */
-    public IllegalDataException(String data, String construct, String reason) {
+    IllegalDataException(String data, String construct, String reason) {
         super(new StringBuffer()
               .append("The data \"")
               .append(data)
@@ -97,7 +97,7 @@
      * @param data <code>String</code> data that breaks rules.
      * @param construct <code>String</code> construct that data is illegal for.
      */
-    public IllegalDataException(String data, String construct) {
+    IllegalDataException(String data, String construct) {
         super(new StringBuffer()
               .append("The data \"")
               .append(data)
@@ -105,5 +105,14 @@
               .append(construct)
               .append(".")
               .toString());
+    }
+
+    /**
+     * This will create an exceptoin with the specified error message.
+     *
+     * @param reason cause of the problem
+     */
+    public IllegalDataException(String reason) {
+        super(reason);
     }
 }
Index: IllegalNameException.java
===================================================================
RCS file: /home/cvs/jdom/src/java/org/jdom/IllegalNameException.java,v
retrieving revision 1.11
diff -u -r1.11 IllegalNameException.java
--- IllegalNameException.java	30 Apr 2003 09:55:12 -0000	1.11
+++ IllegalNameException.java	27 May 2003 19:12:38 -0000
@@ -79,7 +79,7 @@
      *        that <code>name</code> was supplied to.
      * @param reason <code>String</code> message or reason name is illegal.
      */
-    public IllegalNameException(String name, String construct, String reason) {
+    IllegalNameException(String name, String construct, String reason) {
         super(new StringBuffer()
               .append("The name \"")
               .append(name)
@@ -100,7 +100,7 @@
      * @param construct <code>String</code> name of JDOM construct
      *        that <code>name</code> was supplied to.
      */
-    public IllegalNameException(String name, String construct) {
+    IllegalNameException(String name, String construct) {
         super(new StringBuffer()
               .append("The name \"")
               .append(name)
@@ -108,5 +108,14 @@
               .append(construct)
               .append("s.")
               .toString());
+    }
+
+    /**
+     * Creates an exception with the specified error message.
+     *
+     * @param reason cause of the problem
+     */
+    public IllegalNameException(String reason) {
+        super(reason);
     }
 }
Index: IllegalTargetException.java
===================================================================
RCS file: /home/cvs/jdom/src/java/org/jdom/IllegalTargetException.java,v
retrieving revision 1.12
diff -u -r1.12 IllegalTargetException.java
--- IllegalTargetException.java	30 Apr 2003 09:55:12 -0000	1.12
+++ IllegalTargetException.java	27 May 2003 19:12:39 -0000
@@ -76,7 +76,7 @@
      * @param target <code>String</code> target that breaks rules.
      * @param reason <code>String</code> message or reason target is illegal.
      */
-    public IllegalTargetException(String target, String reason) {
+    IllegalTargetException(String target, String reason) {
         super(new StringBuffer()
               .append("The target \"")
               .append(target)
@@ -87,17 +87,11 @@
     }
 
     /**
-     * This will create an <code>Exception</code> indicating
-     * that the specified target is illegal for the
-     * <code>{@link ProcessingInstruction}</code> it was supplied to.
+     * Creates an exception with the specified error message.
      *
-     * @param target <code>String</code> target that breaks rules.
+     * @param reason cause of the problem
      */
-    public IllegalTargetException(String target) {
-        super(new StringBuffer()
-              .append("The name \"")
-              .append(target)
-              .append("\" is not legal for JDOM/XML Processing Instructions.")
-              .toString());
+    public IllegalTargetException(String reason) {
+        super(reason);
     }
 }
Index: JDOMException.java
===================================================================
RCS file: /home/cvs/jdom/src/java/org/jdom/JDOMException.java,v
retrieving revision 1.19
diff -u -r1.19 JDOMException.java
--- JDOMException.java	30 Apr 2003 09:55:12 -0000	1.19
+++ JDOMException.java	27 May 2003 19:12:40 -0000
@@ -79,7 +79,7 @@
       "@(#) $RCSfile: JDOMException.java,v $ $Revision: 1.19 $ $Date: 2003/04/30 09:55:12 $ $Name:  $";
 
     /** A wrapped <code>Throwable</code> */
-    protected Throwable cause;
+    private Throwable cause;
 
     /**
      * This will create an <code>Exception</code>.
Index: Text.java
===================================================================
RCS file: /home/cvs/jdom/src/java/org/jdom/Text.java,v
retrieving revision 1.17
diff -u -r1.17 Text.java
--- Text.java	20 May 2003 21:53:59 -0000	1.17
+++ Text.java	27 May 2003 19:12:41 -0000
@@ -71,7 +71,7 @@
     private static final String CVS_ID = 
       "@(#) $RCSfile: Text.java,v $ $Revision: 1.17 $ $Date: 2003/05/20 21:53:59 $ $Name:  $";
 
-    private static final String EMPTY_STRING = "";
+    static final String EMPTY_STRING = "";
 
     /** The actual character content */
     // XXX See http://www.servlets.com/archive/servlet/ReadMsg?msgId=8612
Index: Verifier.java
===================================================================
RCS file: /home/cvs/jdom/src/java/org/jdom/Verifier.java,v
retrieving revision 1.46
diff -u -r1.46 Verifier.java
--- Verifier.java	23 May 2003 21:59:28 -0000	1.46
+++ Verifier.java	27 May 2003 19:12:45 -0000
@@ -659,7 +659,7 @@
      * @param c  to check for hex digit.
      * @return true if it's allowed, false otherwise.
      */
-    public static boolean isHexDigit(char c) {
+    private static boolean isHexDigit(char c) {
 
     // I suspect most characters passed to this method will be
     // correct hexadecimal digits, so I test for the true cases
@@ -719,7 +719,7 @@
      * @return <code>boolean</code> true if it's a character, 
      *                                false otherwise.
      */
-    public static boolean isXMLCharacter(char c) {
+    private static boolean isXMLCharacter(char c) {
     
         if (c == '\n') return true;
         if (c == '\r') return true;
@@ -742,7 +742,7 @@
      * @return <code>boolean</code> true if it's a name character, 
      *                                false otherwise.
      */
-    public static boolean isXMLNameCharacter(char c) {
+    private static boolean isXMLNameCharacter(char c) {
     
       return (isXMLLetter(c) || isXMLDigit(c) || c == '.' || c == '-' 
                              || c == '_' || c == ':' || isXMLCombiningChar(c) 
@@ -760,7 +760,7 @@
      * @return <code>boolean</code> true if it's a name start character, 
      *                                false otherwise.
      */
-    public static boolean isXMLNameStartCharacter(char c) {
+    private static boolean isXMLNameStartCharacter(char c) {
     
       return (isXMLLetter(c) || c == '_' || c ==':');
     
@@ -775,7 +775,7 @@
      * @return <code>boolean</code> true if it's letter or digit, 
      *                                false otherwise.
      */
-    public static boolean isXMLLetterOrDigit(char c) {
+    private static boolean isXMLLetterOrDigit(char c) {
     
       return (isXMLLetter(c) || isXMLDigit(c));
     
@@ -788,7 +788,7 @@
      * @param c <code>char</code> to check for XML name compliance.
      * @return <code>String</code> true if it's a letter, false otherwise.
      */
-    public static boolean isXMLLetter(char c) {
+    private static boolean isXMLLetter(char c) {
         // Note that order is very important here.  The search proceeds 
         // from lowest to highest values, so that no searching occurs 
         // above the character's value.  BTW, the first line is equivalent to:
@@ -1013,7 +1013,7 @@
      * @return <code>boolean</code> true if it's a combining character,
      *         false otherwise.
      */
-    public static boolean isXMLCombiningChar(char c) {
+    private static boolean isXMLCombiningChar(char c) {
         // CombiningChar
         if (c < 0x0300) return false;  if (c <= 0x0345) return true;
         if (c < 0x0360) return false;  if (c <= 0x0361) return true;
@@ -1147,7 +1147,7 @@
      * @param c <code>char</code> to check.
      * @return <code>String</code> true if it's an extender, false otherwise.
      */
-    public static boolean isXMLExtender(char c) {
+    private static boolean isXMLExtender(char c) {
 
         if (c < 0x00B6) return false;  // quick short circuit
 
@@ -1177,7 +1177,7 @@
      * @param c <code>char</code> to check for XML digit compliance.
      * @return <code>boolean</code> true if it's a digit, false otherwise.
      */
-    public static boolean isXMLDigit(char c) {
+    private static boolean isXMLDigit(char c) {
       
         if (c < 0x0030) return false;  if (c <= 0x0039) return true;
         if (c < 0x0660) return false;  if (c <= 0x0669) return true;


More information about the jdom-interest mailing list