axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "robert lazarski" <robertlazar...@gmail.com>
Subject Re: [Axis2] Axis2 and Enum type
Date Fri, 21 Sep 2007 13:15:11 GMT
This is an old problem. Until Axis2 gets code to support java 5 enums,
 I just do a
simple conversion. With this example in the wsdl:

<element minOccurs="1" maxOccurs="1" nillable="true"
name="TipoMibEnum" type="xsd:int"/>

You'd get that value in the Service with the idea of converting it to this:

public enum TipoMib implements Serializable{

       MIB2,
       MIB_GERENCIA,
       MIB_ESPECIFICA;
}

I do the conversion as:

private static TipoMib getTipoMib(Integer ordinal) {
      if (TipoMib.MIB2.ordinal() == ordinal) {
          return TipoMib.MIB2;
      } else if (TipoMib.MIB_ESPECIFICA.ordinal() == ordinal) {
          return TipoMib.MIB_ESPECIFICA;
      } else if (TipoMib.MIB_GERENCIA.ordinal() == ordinal) {
          return TipoMib.MIB_GERENCIA;
      } else
          return null;
}

To convert the other way I do tipoMib.ordinal() - see the javadoc of
Enum about ordinal() .

HTH,
Robert

On 9/21/07, Mathias P.W Nilsson <mathias@snyltarna.se> wrote:
>
> Did you find any solution to this? I'm having the same problem
> --
> View this message in context: http://www.nabble.com/-Axis2--Axis2-and-Enum-type-tf4350527.html#a12819819
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message