[ 
https://issues.apache.org/jira/browse/CXF-3770?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13134597#comment-13134597
 ] 

Jason Chaffee commented on CXF-3770:
------------------------------------

The example is when the Enum is part of a POJO/bean.

{noformat}
    @GET
    @Path("{storeId}")
    Response getStore(@PathParam("storeId") Long storeId,
        @QueryParam("") StoreParameters params) 
{noformat}

StoreParameters.java: 
{noformat}
public class StoreParameters {
    private String groupId;
    private PromotionTypeEnum promotionType;
    private StatusTypeEnum status;

    /**
     * Creates a new StoreParameters object.
     */
    public StoreParameters() {
    }

    /**
     * Returns the group id value.
     *
     * @return  group id value.
     */
    public String getGroupId() {
        return groupId;
    }

    /**
     * Returns the promotion type value.
     *
     * @return  promotion type value.
     */
    public PromotionTypeEnum getPromotionType() {
        return promotionType;
    }

    /**
     * Returns the status value.
     *
     * @return  status value.
     */
    public StatusTypeEnum getStatus() {
        return status;
    }

    /**
     * Sets the group id value.
     *
     * @param  groupId
     */
    public void setGroupId(final String groupId) {
        this.groupId = groupId;
    }

    /**
     * Sets the promotion type value.
     *
     * @param  promotionType
     */
    public void setPromotionType(final PromotionTypeEnum promotionType) {
        this.promotionType = promotionType;
    }

    /**
     * Sets the status value.
     *
     * @param  status
     */
    public void setStatus(final StatusTypeEnum status) {
        this.status = status;
    }
}
{noformat}

StatusTypeEnum.java: 
{noformat}
@XmlEnum public enum StatusTypeEnum implements Serializable {
    @XmlEnumValue("Deactivated")
    DEACTIVATED(4L, "Deactivated"),
    @XmlEnumValue("*")
    DEFAULT(-1L, "*"),
    @XmlEnumValue("In Progress")
    IN_PROGRESS(1L, "In Progress"),
    @XmlEnumValue("Limited Published")
    LIMITED_PUBLISHED(3L, "Limited Published"),
    @XmlEnumValue("Published")
    PUBLISHED(2L, "Published");

    private final String name;
    private final Long value;

    private StatusTypeEnum(final Long v, final String n) {
        this.value = v;
        this.name = n;
    }

    public static StatusTypeEnum fromValue(final Long v) {
        for (final StatusTypeEnum c : StatusTypeEnum.values()) {
            if (c.value.equals(v)) {
                return c;
            }
        }

        return null;
    }

    public static StatusTypeEnum fromValue(final String n) {
        for (final StatusTypeEnum c : StatusTypeEnum.values()) {
            if (c.name.equalsIgnoreCase(n)) {
                return c;
            }
        }

        return null;
    }

    public String nameValue() {
        return this.name;
    }

    public String toString() {
        return nameValue();
    }

    public Long value() {
        return value;
    }
{noformat}

I expect the @XmlEnumValue to be used for the <option> element.
                
> WADL Generator does not handle Enums correctly
> ----------------------------------------------
>
>                 Key: CXF-3770
>                 URL: https://issues.apache.org/jira/browse/CXF-3770
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>            Reporter: Sergey Beryozkin
>            Assignee: Sergey Beryozkin
>             Fix For: 2.4.3, 2.5
>
>
> WADL generator should print multiple options when dealing with Enum

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to