< prev index next >

src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAttribute.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 54,65 **** * <li> If type of the field or the property is a collection * type, then the collection item type must be mapped to schema * simple type. * <pre> * // Examples ! * @XmlAttribute List&lt;Integer> items; //legal ! * @XmlAttribute List&lt;Bar> foo; // illegal if Bar does not map to a schema simple type * </pre> * </li> * <li> If the type of the field or the property is a non * collection type, then the type of the property or field * must map to a simple schema type. --- 54,65 ---- * <li> If type of the field or the property is a collection * type, then the collection item type must be mapped to schema * simple type. * <pre> * // Examples ! * @XmlAttribute List&lt;Integer&gt; items; //legal ! * @XmlAttribute List&lt;Bar&gt; foo; // illegal if Bar does not map to a schema simple type * </pre> * </li> * <li> If the type of the field or the property is a non * collection type, then the type of the property or field * must map to a simple schema type.
*** 78,125 **** * {@link XmlAttachmentRef}, * {@link XmlMimeType}, * {@link XmlInlineBinaryData}, * {@link javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter}.</li> * </ul> - * </p> * * <p> <b>Example 1: </b>Map a JavaBean property to an XML attribute.</p> * <pre> * //Example: Code fragment * public class USPrice { * @XmlAttribute * public java.math.BigDecimal getPrice() {...} ; * public void setPrice(java.math.BigDecimal ) {...}; * } * ! * &lt;!-- Example: XML Schema fragment --> ! * &lt;xs:complexType name="USPrice"> ! * &lt;xs:sequence> ! * &lt;/xs:sequence> ! * &lt;xs:attribute name="price" type="xs:decimal"/> ! * &lt;/xs:complexType> * </pre> * * <p> <b>Example 2: </b>Map a JavaBean property to an XML attribute with anonymous type.</p> * See Example 7 in @{@link XmlType}. * * <p> <b>Example 3: </b>Map a JavaBean collection property to an XML attribute.</p> * <pre> * // Example: Code fragment * class Foo { * ... ! * @XmlAttribute List&lt;Integer> items; * } * ! * &lt;!-- Example: XML Schema fragment --> ! * &lt;xs:complexType name="foo"> * ... ! * &lt;xs:attribute name="items"> ! * &lt;xs:simpleType> ! * &lt;xs:list itemType="xs:int"/> ! * &lt;/xs:simpleType> ! * &lt;/xs:complexType> * * </pre> * @author Sekhar Vajjhala, Sun Microsystems, Inc. * @see XmlType * @since 1.6, JAXB 2.0 --- 78,124 ---- * {@link XmlAttachmentRef}, * {@link XmlMimeType}, * {@link XmlInlineBinaryData}, * {@link javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter}.</li> * </ul> * * <p> <b>Example 1: </b>Map a JavaBean property to an XML attribute.</p> * <pre> * //Example: Code fragment * public class USPrice { * @XmlAttribute * public java.math.BigDecimal getPrice() {...} ; * public void setPrice(java.math.BigDecimal ) {...}; * } * ! * &lt;!-- Example: XML Schema fragment --&gt; ! * &lt;xs:complexType name="USPrice"&gt; ! * &lt;xs:sequence&gt; ! * &lt;/xs:sequence&gt; ! * &lt;xs:attribute name="price" type="xs:decimal"/&gt; ! * &lt;/xs:complexType&gt; * </pre> * * <p> <b>Example 2: </b>Map a JavaBean property to an XML attribute with anonymous type.</p> * See Example 7 in @{@link XmlType}. * * <p> <b>Example 3: </b>Map a JavaBean collection property to an XML attribute.</p> * <pre> * // Example: Code fragment * class Foo { * ... ! * @XmlAttribute List&lt;Integer&gt; items; * } * ! * &lt;!-- Example: XML Schema fragment --&gt; ! * &lt;xs:complexType name="foo"&gt; * ... ! * &lt;xs:attribute name="items"&gt; ! * &lt;xs:simpleType&gt; ! * &lt;xs:list itemType="xs:int"/&gt; ! * &lt;/xs:simpleType&gt; ! * &lt;/xs:complexType&gt; * * </pre> * @author Sekhar Vajjhala, Sun Microsystems, Inc. * @see XmlType * @since 1.6, JAXB 2.0
< prev index next >