Differences between revisions 2 and 3
Revision 2 as of 2007-11-23 16:45:39
Size: 1814
Editor: blueice3n1
Revision 3 as of 2009-09-20 22:47:29
Size: 1814
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

Use of typed arrays instead of Java collections

Concerns have been raised about the use of typed arrays in the Woden API to represent collections of WSDL objects, with suggestions about using the standard Java collections classes and Java 5 generics for type safety. Even with Java 1.4, some prefer using Java collections based on java.lang.Object.

One of the initial design goals of the Woden API (and a key difference to the WSDL4J API) was to provide compile-time type safety and minimize the need for the API client application to cast java.lang.Object. When the Woden project began in early 2005 Java 1.4 was more widely used than Java 5 so we decided to base Woden on Java 1.4. That meant using typed arrays for type-safe collections, rather than Java 5 generics. An alternative might have been to create type-specific collection classes.

These typed arrays returned by the Woden API are effectively read-only collections. The Woden objects referenced in the array elements can be modified via their APIs, but the collection of objects represented by the array can only be modified by using the appropriate accessor methods on the parent object - e.g. addXXX() and removeXXX(). Changing the object reference of an array element will not change Woden's internal model of the WSDL. This point is not made clear in the API Javadoc, but it probably should be.

As Woden development progressed during 2006 and 2007 and Axis2 became the main Woden user, we continued to base Woden on Java 1.4 as that is the minimum Java level supported by Axis2. We can't really move Woden to Java 5 until Axis2 moves, so the question remaining is do we use the Java 1.4 collection interfaces, which are based on java.lang.Object and require casting by the API clients, instead of typed arrays in the Woden API.

FrontPage/Woden/APIReview/TypedArrays (last edited 2009-09-20 22:47:29 by localhost)