1 /* 2 * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package javax.xml.bind.annotation; 27 28 import static java.lang.annotation.ElementType.TYPE; 29 import java.lang.annotation.Retention; 30 import static java.lang.annotation.RetentionPolicy.RUNTIME; 31 import java.lang.annotation.Target; 32 33 /** 34 * <p> 35 * Maps an enum type {@link Enum} to XML representation. 36 * 37 * <p>This annotation, together with {@link XmlEnumValue} provides a 38 * mapping of enum type to XML representation. 39 * 40 * <p> <b>Usage</b> </p> 41 * <p> 42 * The {@code @XmlEnum} annotation can be used with the 43 * following program elements: 44 * <ul> 45 * <li>enum type</li> 46 * </ul> 47 * 48 * <p> The usage is subject to the following constraints: 49 * <ul> 50 * <li> This annotation can be used the following other annotations: 51 * {@link XmlType}, 52 * {@link XmlRootElement} </li> 53 * </ul> 54 * <p>See "Package Specification" in javax.xml.bind.package javadoc for 55 * additional common information </p> 56 * 57 * <p>An enum type is mapped to a schema simple type with enumeration 58 * facets. The schema type is derived from the Java type to which 59 * {@code @XmlEnum.value()}. Each enum constant {@code @XmlEnumValue} 60 * must have a valid lexical representation for the type 61 * {@code @XmlEnum.value()}. 62 * 63 * <p><b>Examples:</b> See examples in {@link XmlEnumValue} 64 * 65 * @since 1.6, JAXB 2.0 66 */ 67 68 @Retention(RUNTIME) @Target({TYPE}) 69 public @interface XmlEnum { 70 /** 71 * Java type that is mapped to a XML simple type. 72 * 73 */ 74 Class<?> value() default String.class; 75 }