< prev index next >

src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapter.java

Print this page




  33 import javax.xml.bind.annotation.XmlAttribute;
  34 import javax.xml.bind.annotation.XmlSchema;
  35 import javax.xml.bind.annotation.XmlAccessorType;
  36 import javax.xml.bind.annotation.XmlSchemaTypes;
  37 import java.lang.annotation.Target;
  38 import java.lang.annotation.Retention;
  39 
  40 import static java.lang.annotation.RetentionPolicy.RUNTIME;
  41 import static java.lang.annotation.ElementType.FIELD;
  42 import static java.lang.annotation.ElementType.METHOD;
  43 import static java.lang.annotation.ElementType.TYPE;
  44 import static java.lang.annotation.ElementType.PARAMETER;
  45 import static java.lang.annotation.ElementType.PACKAGE;
  46 
  47 
  48 /**
  49  * Use an adapter that implements {@link XmlAdapter} for custom marshaling.
  50  *
  51  * <p> <b> Usage: </b> </p>
  52  *
  53  * <p> The <tt>@XmlJavaTypeAdapter</tt> annotation can be used with the
  54  * following program elements:
  55  * <ul>
  56  *   <li> a JavaBean property </li>
  57  *   <li> field </li>
  58  *   <li> parameter </li>
  59  *   <li> package </li>
  60  *   <li> from within {@link XmlJavaTypeAdapters} </li>
  61  * </ul>
  62  *
  63  * <p> When <tt>@XmlJavaTypeAdapter</tt> annotation is defined on a
  64  * class, it applies to all references to the class.
  65  * <p> When <tt>@XmlJavaTypeAdapter</tt> annotation is defined at the
  66  * package level it applies to all references from within the package
  67  * to <tt>@XmlJavaTypeAdapter.type()</tt>.
  68  * <p> When <tt>@XmlJavaTypeAdapter</tt> annotation is defined on the
  69  * field, property or parameter, then the annotation applies to the
  70  * field, property or the parameter only.
  71  * <p> A <tt>@XmlJavaTypeAdapter</tt> annotation on a field, property
  72  * or parameter overrides the <tt>@XmlJavaTypeAdapter</tt> annotation
  73  * associated with the class being referenced by the field, property
  74  * or parameter.
  75  * <p> A <tt>@XmlJavaTypeAdapter</tt> annotation on a class overrides
  76  * the <tt>@XmlJavaTypeAdapter</tt> annotation specified at the
  77  * package level for that class.
  78  *
  79  * <p>This annotation can be used with the following other annotations:
  80  * {@link XmlElement}, {@link XmlAttribute}, {@link XmlElementRef},
  81  * {@link XmlElementRefs}, {@link XmlAnyElement}. This can also be
  82  * used at the package level with the following annotations:
  83  * {@link XmlAccessorType}, {@link XmlSchema}, {@link XmlSchemaType},
  84  * {@link XmlSchemaTypes}.
  85  *
  86  * <p><b> Example: </b> See example in {@link XmlAdapter}
  87  *
  88  * @author <ul><li>Sekhar Vajjhala, Sun Microsystems Inc.</li> <li> Kohsuke Kawaguchi, Sun Microsystems Inc.</li></ul>
  89  * @since 1.6, JAXB 2.0
  90  * @see XmlAdapter
  91  */
  92 
  93 @Retention(RUNTIME) @Target({PACKAGE,FIELD,METHOD,TYPE,PARAMETER})
  94 public @interface XmlJavaTypeAdapter {
  95     /**
  96      * Points to the class that converts a value type to a bound type or vice versa.


  33 import javax.xml.bind.annotation.XmlAttribute;
  34 import javax.xml.bind.annotation.XmlSchema;
  35 import javax.xml.bind.annotation.XmlAccessorType;
  36 import javax.xml.bind.annotation.XmlSchemaTypes;
  37 import java.lang.annotation.Target;
  38 import java.lang.annotation.Retention;
  39 
  40 import static java.lang.annotation.RetentionPolicy.RUNTIME;
  41 import static java.lang.annotation.ElementType.FIELD;
  42 import static java.lang.annotation.ElementType.METHOD;
  43 import static java.lang.annotation.ElementType.TYPE;
  44 import static java.lang.annotation.ElementType.PARAMETER;
  45 import static java.lang.annotation.ElementType.PACKAGE;
  46 
  47 
  48 /**
  49  * Use an adapter that implements {@link XmlAdapter} for custom marshaling.
  50  *
  51  * <p> <b> Usage: </b> </p>
  52  *
  53  * <p> The {@code @XmlJavaTypeAdapter} annotation can be used with the
  54  * following program elements:
  55  * <ul>
  56  *   <li> a JavaBean property </li>
  57  *   <li> field </li>
  58  *   <li> parameter </li>
  59  *   <li> package </li>
  60  *   <li> from within {@link XmlJavaTypeAdapters} </li>
  61  * </ul>
  62  *
  63  * <p> When {@code @XmlJavaTypeAdapter} annotation is defined on a
  64  * class, it applies to all references to the class.
  65  * <p> When {@code @XmlJavaTypeAdapter} annotation is defined at the
  66  * package level it applies to all references from within the package
  67  * to {@code @XmlJavaTypeAdapter.type()}.
  68  * <p> When {@code @XmlJavaTypeAdapter} annotation is defined on the
  69  * field, property or parameter, then the annotation applies to the
  70  * field, property or the parameter only.
  71  * <p> A {@code @XmlJavaTypeAdapter} annotation on a field, property
  72  * or parameter overrides the {@code @XmlJavaTypeAdapter} annotation
  73  * associated with the class being referenced by the field, property
  74  * or parameter.
  75  * <p> A {@code @XmlJavaTypeAdapter} annotation on a class overrides
  76  * the {@code @XmlJavaTypeAdapter} annotation specified at the
  77  * package level for that class.
  78  *
  79  * <p>This annotation can be used with the following other annotations:
  80  * {@link XmlElement}, {@link XmlAttribute}, {@link XmlElementRef},
  81  * {@link XmlElementRefs}, {@link XmlAnyElement}. This can also be
  82  * used at the package level with the following annotations:
  83  * {@link XmlAccessorType}, {@link XmlSchema}, {@link XmlSchemaType},
  84  * {@link XmlSchemaTypes}.
  85  *
  86  * <p><b> Example: </b> See example in {@link XmlAdapter}
  87  *
  88  * @author <ul><li>Sekhar Vajjhala, Sun Microsystems Inc.</li> <li> Kohsuke Kawaguchi, Sun Microsystems Inc.</li></ul>
  89  * @since 1.6, JAXB 2.0
  90  * @see XmlAdapter
  91  */
  92 
  93 @Retention(RUNTIME) @Target({PACKAGE,FIELD,METHOD,TYPE,PARAMETER})
  94 public @interface XmlJavaTypeAdapter {
  95     /**
  96      * Points to the class that converts a value type to a bound type or vice versa.
< prev index next >