[jbossws-users] [JBossWS] - urgent: java enums and mapping file...

tejasjani do-not-reply at jboss.com
Wed Jan 31 02:06:06 EST 2007


Hi all...

I am in urgent need of help.

I have some enum types defined in my schema. I have already written the associated enum type classes for them as described in some other posts here.

Now, I am not able to figure out how to change the jaxrpc-mapping file to map the xml enum types to the Java type classes.

I have looked for answers in a lot of places but could not find it.

Pls. help.

thanks

e.g. 
Here is the enum type
<xsd:simpleType name="StatusType">
    
    <xsd:restriction base="xsd:string">
      
      <!-- The operation was successful. -->
      <xsd:enumeration value="Success" />
      
      <!-- An error occured while processing the request. -->
      <xsd:enumeration value="SystemError" />
      
      <!-- An error occurred due to input given from  the user  -->
      <xsd:enumeration  value="UserError"  />
        
    </xsd:restriction>
  </xsd:simpleType>
-------------------------------------

Here is its Java type:

import java.io.Serializable;

public class StatusType implements Serializable {
    private java.lang.String _value_;
    private static java.util.HashMap _table_ = new java.util.HashMap();

//     Constructor
    protected StatusType(java.lang.String value)
    {
    _value_ = value;
    _table_.put(_value_,this);
    }

    public static final java.lang.String _SUCCESS = "Success";
    public static final java.lang.String _SYSTEMERROR = "SystemError";
    public static final java.lang.String _USERERROR = "UserError";
    public static final StatusType SUCCESS = new StatusType(_SUCCESS);
    public static final StatusType USERERROR = new StatusType(_USERERROR);
    public static final StatusType SYSTEMERROR = new StatusType(_SYSTEMERROR);
    
    public java.lang.String getValue() { return _value_;}
    public static StatusType fromValue(java.lang.String value)
    throws java.lang.IllegalArgumentException
    {
        StatusType enumeration = (StatusType)_table_.get(value);
    if (enumeration==null) throw new java.lang.IllegalArgumentException();
    return enumeration;
    }
    public static StatusType fromString(java.lang.String value)
    throws java.lang.IllegalArgumentException
    {
    return fromValue(value);
    }
    public boolean equals(java.lang.Object obj) {return (obj == this);}
    public int hashCode() { return toString().hashCode();}
    public java.lang.String toString() { return _value_;}
    public java.lang.Object readResolve() throws java.io.ObjectStreamException { return fromValue(_value_);}

}
-------------------------------------------------



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4008668#4008668

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4008668



More information about the jbossws-users mailing list