[
https://issues.apache.org/jira/browse/AVRO-1392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13815140#comment-13815140
]
Balaji Seshadri commented on AVRO-1392:
---------------------------------------
Is it mandatory that enum should be in same package, we have it in different
package.
package com.dish.des.msgs.biz.common.enums;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;
import com.dish.des.msgs.DESNamespaces;
@XmlType(namespace = DESNamespaces.BIZ_COMMON_ENUM_NAMESPACE)
@XmlEnum
public enum UserTypeEnum {
AGENT,
CUSTOMER;
public String value() { return name(); }
public static UserTypeEnum fromValue(String v) { return valueOf(v); }
}
package com.dish.des.msgs.biz.common.enums;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;
import com.dish.des.msgs.DESNamespaces;
@XmlType(namespace = DESNamespaces.BIZ_COMMON_ENUM_NAMESPACE)
@XmlEnum
public enum ApplicationEnum {
DISH_PROMO,
CSAWEB;
public String value() { return name(); }
public static ApplicationEnum fromValue(String v) { return valueOf(v); }
}
Whats the avro version you are using ,im using 1.7.5.
> Unable to marshal enum to Avro
> ------------------------------
>
> Key: AVRO-1392
> URL: https://issues.apache.org/jira/browse/AVRO-1392
> Project: Avro
> Issue Type: Bug
> Components: java
> Environment: DEV
> Reporter: Balaji Seshadri
> Priority: Blocker
>
> I'm trying to marshall below object to Avro format and unable to marshall it
> using ReflectDatum Writer.Enums are being rejected while marshalling.
> {code:java}
> public class AccountAccess extends DESBusinessEvent<String> {
> @XmlElement(required = true)
> protected String accountId;
> @XmlElement(required = true)
> @XmlSchemaType(name = "dateTime")
> @AvroEncode(using=XmlDateAsLong.class)
> protected XMLGregorianCalendar dateTime;
> // @XmlElement(namespace = DESNamespaces.ENUM_NAMESPACE, required = true)
> @XmlElement(required = true)
> @Stringable
> protected ApplicationEnum application;
> // @XmlElement(namespace = DESNamespaces.ENUM_NAMESPACE, required = true)
> @XmlElement(required = true)
> @Stringable
> protected UserTypeEnum userType;
> protected String userId;
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.1#6144)