You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2009/02/16 07:03:42 UTC
svn commit: r744817 - in
/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces: impl/dv/xs/
xs/ xs/datatypes/
Author: mrglavas
Date: Mon Feb 16 06:03:41 2009
New Revision: 744817
URL: http://svn.apache.org/viewvc?rev=744817&view=rev
Log:
JIRA Issue #1360:
https://issues.apache.org/jira/browse/XERCESJ-1360
XML Schema API Usability improvements. Making all of the list types extend
java.util.List and making XSNamedMap extend java.util.Map.
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/LSInputList.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/ShortList.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/StringList.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSNamedMap.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSNamespaceItemList.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSObjectList.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/datatypes/ByteList.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/datatypes/ObjectList.java
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java?rev=744817&r1=744816&r2=744817&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java Mon Feb 16 06:03:41 2009
@@ -17,6 +17,7 @@
package org.apache.xerces.impl.dv.xs;
+import java.util.AbstractList;
import java.util.Locale;
import java.util.StringTokenizer;
import java.util.Vector;
@@ -2222,7 +2223,7 @@
*/
public ObjectList getActualEnumeration() {
if (fActualEnumeration == null) {
- fActualEnumeration = new ObjectList () {
+ fActualEnumeration = new AbstractObjectList() {
public int getLength() {
return (fEnumeration != null) ? fEnumeration.size() : 0;
}
@@ -2248,7 +2249,7 @@
if (fEnumerationItemTypeList == null) {
if(fEnumerationItemType == null)
return null;
- fEnumerationItemTypeList = new ObjectList () {
+ fEnumerationItemTypeList = new AbstractObjectList() {
public int getLength() {
return (fEnumerationItemType != null) ? fEnumerationItemType.length : 0;
}
@@ -3339,6 +3340,18 @@
return XSConstants.MULTIVALUE_FACET;
}
}
+
+ private static abstract class AbstractObjectList extends AbstractList implements ObjectList {
+ public Object get(int index) {
+ if (index >= 0 && index < getLength()) {
+ return item(index);
+ }
+ throw new IndexOutOfBoundsException("Index: " + index);
+ }
+ public int size() {
+ return getLength();
+ }
+ }
public String getTypeNamespace() {
return getNamespace();
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/LSInputList.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/LSInputList.java?rev=744817&r1=744816&r2=744817&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/LSInputList.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/LSInputList.java Mon Feb 16 06:03:41 2009
@@ -17,6 +17,8 @@
package org.apache.xerces.xs;
+import java.util.List;
+
import org.w3c.dom.ls.LSInput;
/**
@@ -24,7 +26,7 @@
* ordered collection of <code>LSInput</code>s, without defining or
* constraining how this collection is implemented.
*/
-public interface LSInputList {
+public interface LSInputList extends List {
/**
* The number of <code>LSInput</code>s in the list. The range of valid
* child object indices is 0 to <code>length-1</code> inclusive.
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/ShortList.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/ShortList.java?rev=744817&r1=744816&r2=744817&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/ShortList.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/ShortList.java Mon Feb 16 06:03:41 2009
@@ -17,11 +17,13 @@
package org.apache.xerces.xs;
+import java.util.List;
+
/**
* The <code>ShortList</code> is an immutable ordered collection of
* <code>unsigned short</code>.
*/
-public interface ShortList {
+public interface ShortList extends List {
/**
* The number of <code>unsigned short</code>s in the list. The range of
* valid child object indices is 0 to <code>length-1</code> inclusive.
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/StringList.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/StringList.java?rev=744817&r1=744816&r2=744817&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/StringList.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/StringList.java Mon Feb 16 06:03:41 2009
@@ -17,11 +17,13 @@
package org.apache.xerces.xs;
+import java.util.List;
+
/**
* The <code>StringList</code> is an immutable ordered collection of
* <code>GenericString</code>.
*/
-public interface StringList {
+public interface StringList extends List {
/**
* The number of <code>GenericString</code>s in the list. The range of
* valid child object indices is 0 to <code>length-1</code> inclusive.
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSNamedMap.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSNamedMap.java?rev=744817&r1=744816&r2=744817&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSNamedMap.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSNamedMap.java Mon Feb 16 06:03:41 2009
@@ -17,6 +17,8 @@
package org.apache.xerces.xs;
+import java.util.Map;
+
/**
* Objects implementing the <code>XSNamedMap</code> interface are used to
* represent immutable collections of XML Schema components that can be
@@ -24,7 +26,7 @@
* <code>XSObjectList</code>. The <code>XSObject</code>s in
* <code>XSNamedMap</code>s are not maintained in any particular order.
*/
-public interface XSNamedMap {
+public interface XSNamedMap extends Map {
/**
* The number of <code>XSObjects</code> in the <code>XSObjectList</code>.
* The range of valid child object indices is 0 to <code>length-1</code>
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSNamespaceItemList.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSNamespaceItemList.java?rev=744817&r1=744816&r2=744817&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSNamespaceItemList.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSNamespaceItemList.java Mon Feb 16 06:03:41 2009
@@ -17,12 +17,14 @@
package org.apache.xerces.xs;
+import java.util.List;
+
/**
* The <code>XSNamesaceItemList</code> interface provides the abstraction of
* an immutable ordered collection of <code>XSNamespaceItem</code>s, without
* defining or constraining how this collection is implemented.
*/
-public interface XSNamespaceItemList {
+public interface XSNamespaceItemList extends List {
/**
* The number of <code>XSNamespaceItem</code>s in the list. The range of
* valid child object indices is 0 to <code>length-1</code> inclusive.
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSObjectList.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSObjectList.java?rev=744817&r1=744816&r2=744817&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSObjectList.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/XSObjectList.java Mon Feb 16 06:03:41 2009
@@ -17,12 +17,14 @@
package org.apache.xerces.xs;
+import java.util.List;
+
/**
* The <code>XSObjectList</code> interface provides the abstraction of an
* immutable ordered collection of <code>XSObject</code>s, without defining
* or constraining how this collection is implemented.
*/
-public interface XSObjectList {
+public interface XSObjectList extends List {
/**
* The number of <code>XSObjects</code> in the list. The range of valid
* child object indices is 0 to <code>length-1</code> inclusive.
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/datatypes/ByteList.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/datatypes/ByteList.java?rev=744817&r1=744816&r2=744817&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/datatypes/ByteList.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/datatypes/ByteList.java Mon Feb 16 06:03:41 2009
@@ -16,6 +16,8 @@
*/
package org.apache.xerces.xs.datatypes;
+import java.util.List;
+
import org.apache.xerces.xs.XSException;
/**
@@ -26,7 +28,7 @@
*
* @version $Id$
*/
-public interface ByteList {
+public interface ByteList extends List {
/**
* The number of <code>byte</code>s in the list. The range of
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/datatypes/ObjectList.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/datatypes/ObjectList.java?rev=744817&r1=744816&r2=744817&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/datatypes/ObjectList.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xs/datatypes/ObjectList.java Mon Feb 16 06:03:41 2009
@@ -16,6 +16,8 @@
*/
package org.apache.xerces.xs.datatypes;
+import java.util.List;
+
/**
* <p>The <code>ObjectList</code> is an immutable ordered collection of
* <code>Object</code>.</p>
@@ -24,7 +26,7 @@
*
* @version $Id$
*/
-public interface ObjectList {
+public interface ObjectList extends List {
/**
* The number of <code>Object</code>s in the list. The range of
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org