users@jax-rpc.java.net

Re: Fwd: Going Java to WSDL using enums and wscompile

From: Doug Kohlert <Doug.Kohlert_at_Sun.COM>
Date: Mon, 11 Jul 2005 10:51:08 -0700

Jonathan,
This cannot be done with JAX-RPC, however, JAX-WS does support Java 5.0
enums.

Jonathan Chase wrote:

>Oops, I forgot to copy the source code to the email:D
>
>package ...
>
>import java.io.Serializable;
>
>public class MailMessageRecipientType implements Serializable {
>public MailMessageRecipientType (){}
> private static final long serialVersionUID = 3979268058034484792L;
>
> private String value;
>
> protected MailMessageRecipientType(String value) {
> if (value == null
> || (!(value.equals(_TO)) && !(value.equals(_CC)) && !(value
> .equals(_BCC)))) {
> throw new IllegalArgumentException("the value [" + value
> + "] is not permitted, please pass either [" + _TO + "], ["
> + _CC + "], or [" + _BCC + "]");
> }
> this.value = value;
> }
>
> public static final String _TO = "TO";
>
> public static final String _CC = "CC";
>
> public static final String _BCC = "BCC";
>
> public static final MailMessageRecipientType TO = new
>MailMessageRecipientType(
> _TO);
>
> public static final MailMessageRecipientType CC = new
>MailMessageRecipientType(
> _CC);
>
> public static final MailMessageRecipientType BCC = new
>MailMessageRecipientType(
> _BCC);
>
> public String getValue() {
> return value;
> }
>
> public static MailMessageRecipientType fromValue(String value)
> throws IllegalArgumentException {
> if (TO.value.equals(value)) {
> return TO;
> } else if (CC.value.equals(value)) {
> return CC;
> } else if (BCC.value.equals(value)) {
> return BCC;
> }
> throw new IllegalArgumentException("the value [" + value
> + "] is not permitted, please pass either [" + _TO + "], ["
> + _CC + "], or [" + _BCC + "]");
> }
>
> public static MailMessageRecipientType fromString(String value)
> throws IllegalArgumentException {
> return fromValue(value);
> }
>
> public String toString() {
> return value;
> }
>
> public boolean equals(Object o) {
> if (!(o instanceof MailMessageRecipientType)) {
> return false;
> }
> return ((MailMessageRecipientType) o).getValue().equals(
> this.getValue());
> }
>
> public int hashCode() {
> return this.getValue().hashCode();
> }
>}
>
>
>---------- Forwarded message ----------
>From: Jonathan Chase <jon.chase.junk_at_gmail.com>
>Date: Jun 28, 2005 12:37 PM
>Subject: Going Java to WSDL using enums and wscompile
>To: users_at_jax-rpc.dev.java.net
>
>
>Is it possible to start with a Java class (included at bottom of
>message) which adheres to the JAX-RPC structure for a Java enumeration
>(sec. 4.2.4 in the spec) and go from Java to WSDL?
>
>It seems there is no problem going WSDL to Java, if you already have
>an enum defined in the WSDL...but if doing Java to WSDL and requiring
>enums, how in the world can one do it?
>
>Any help would be *greatly* appreciated.
>
>Thanks,
>Jon
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
>For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>
>
>

-- 
 - Doug