< 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<Integer> items; //legal
! * @XmlAttribute List<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<Integer> items; //legal
! * @XmlAttribute List<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.
*** 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 ) {...};
* }
*
! * <!-- Example: XML Schema fragment -->
! * <xs:complexType name="USPrice">
! * <xs:sequence>
! * </xs:sequence>
! * <xs:attribute name="price" type="xs:decimal"/>
! * </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<Integer> items;
* }
*
! * <!-- Example: XML Schema fragment -->
! * <xs:complexType name="foo">
* ...
! * <xs:attribute name="items">
! * <xs:simpleType>
! * <xs:list itemType="xs:int"/>
! * </xs:simpleType>
! * </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 ) {...};
* }
*
! * <!-- Example: XML Schema fragment -->
! * <xs:complexType name="USPrice">
! * <xs:sequence>
! * </xs:sequence>
! * <xs:attribute name="price" type="xs:decimal"/>
! * </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<Integer> items;
* }
*
! * <!-- Example: XML Schema fragment -->
! * <xs:complexType name="foo">
* ...
! * <xs:attribute name="items">
! * <xs:simpleType>
! * <xs:list itemType="xs:int"/>
! * </xs:simpleType>
! * </xs:complexType>
*
* </pre>
* @author Sekhar Vajjhala, Sun Microsystems, Inc.
* @see XmlType
* @since 1.6, JAXB 2.0
< prev index next >