I am amazed to see that other are also interested in doing enumerations.  But I 
guess you are coming for the XML presepctive. The answer to your questions is 
yes. See the following for detials.

I am still wondering if Axis will ever support Java 1.5 Enums.

-- Paul



---- snip JAX-RPC Spec ----
According to the JAX-RPC spec Axis supports the following:
-38
Enumeration
An XML enumeration is a specific list of distinct values appropriate for a base 
type. The
XML Schema Part 2: Datatypes specification supports enumerations for all simple 
builtin
types except for xsd:boolean.
An XML enumeration is mapped by default to a Java class with the same name as 
the
enumeration type. If the enumeration is anonymous, then the name of the nearest
enclosing xsd:attribute, xsd:element, xsd:simpleType or xsd:complexType is
used instead.
In order to be compatible with the JAXB 1.0 specification [14], in addition to 
the default
mapping given above JAX-RPC implementations are required to support mapping
anonymous enumerations using the rules for simple types derived via restriction 
given in
section 4.2.5.
The mapped Java class declares a getValue method, two static data members per 
label,
an integer conversion method and a constructor as follows:
//Java
public class <enumeration_name> {
// ...
// Constructor
protected <enumeration_name>(<base_type> value) { ... }
// One for each label in the enumeration
public static final <base_type> _<label> = <value>;
public static final <enumeration_name> <label> =
new <enumeration_name>(_<label>);
// Gets the value for a enumerated value
public <base_type> getValue() {...}
// Gets enumeration with a specific value
// Required to throw java.lang.IllegalArgumentException if
// any invalid value is specified
public static <enumeration_name> fromValue(<base_type> value) {
... }
// Gets enumeration from a String
// Required to throw java.lang.IllegalArgumentException if
// any invalid value is specified
public static <enumeration_name> fromString(String value){ ... }
// Returns String representation of the enumerated value
public String toString() { ... }
public boolean equals(Object obj) { ... }
public int hashCode() { ... }
}
All _<label> and <label> used in the mapped Java class (for XML enumeration) are
required to be valid Java identifiers. According to the Java language 
specification, a Java
identifier cannot have the same spelling as a Java keyword, Boolean literal or 
null
literal.
If one or more enumerated values in an XML enumeration cannot map to valid Java
identifiers (examples are "3.14", "int"), the mapped Java class is required to 
use Java
identifiers value<1..N> and _value<1..N> for <label> and _<label> (as in the 
above
mapping code snippet) respectively. The numeric suffix starts from 1 and 
increments by
1 per value in the XML enumeration. Examples are _value1, value1, value2 and
_value2.
Example
The following shows an example of XML enumeration and its schema fragment:
<!-- XML Schema fragment -->
<element name="EyeColor" type="EyeColorType"/>
<simpleType name="EyeColorType">
<restriction base="xsd:string">
<enumeration value="green"/>
<enumeration value="blue"/>
</restriction>
</simpleType>
<!-- XML Schema instance -->
<EyeColor>green</EyeColor>
The following code snippet show the Java mapping for the above XML enumeration:
//Java
public class EyeColorType {
// Constructor
protected EyeColorType(String value) { ... }
public static final String _green = "green";
public static final String _blue = "blue";
public static final EyeColorType green = new EyeColorType(_green);
public static final EyeColorType blue = new EyeColorType(_blue);
public String getValue() { ... }
public static EyeColorType fromValue(String value) { ... }
public boolean equals(Object obj) { ... }
public int hashCode() { ... }
// ... Other methods not shown
}
Here's the same XML enumeration type, this type defined as an anonymous type:
<!-- XML Schema fragment -->
<element name="EyeColor">
<simpleType>
<restriction base="xsd:string">
<enumeration value="green"/>
<enumeration value="blue"/>
</restriction>
</simpleType>
</element>
The default mapping for this enumeration type is the same as for the 
non-anonymous
case. Additionally, implementations are also required to support mapping this
enumeration type to the java.lang.String type, so as to be compatible with the 
JAXB
1.0 specification.



> -----Original Message-----
> From: jayachandra [mailto:[EMAIL PROTECTED]
> Sent: Donnerstag, 20. Januar 2005 13:30
> To: [EMAIL PROTECTED]; axis-dev@ws.apache.org
> Subject: Does Axis support list enumeration?
> 
> 
> Dominik and all,
> As on date, does Axis support list enumeration? WSDL2Java is
> succeeding in producing some code for list enumeration in wsdl, but
> the generated code is incomplete (no enumeration specific
> variables/fields are found in the code). Am I missing something, or
> does it have to do with incomplete support for list enumeration.
> 
> Any information in this regard, will be very much appreciated.
> 
> Thank you,
> Jayachandra
> -- 
> -- Jaya
> 
> .
> 

.

Reply via email to