Geen cache-versie.

Caching uitgeschakeld. Standaardinstelling voor deze pagina:ingeschakeld (code LNG204)
Als het scherm te langzaam is, kunt u de gebruikersmodus uitschakelen om de cacheversie te bekijken.
javax.xml.bind.annotation

Annotation Type XmlAttribute


  • @Retention(value=RUNTIME)
    @Target(value={FIELD,METHOD})
    public @interface XmlAttribute

    Maps a JavaBean property to a XML attribute.

    Usage

    The @XmlAttribute annotation can be used with the following program elements:

    • JavaBean property
    • field

    A static final field is mapped to a XML fixed attribute.

    See "Package Specification" in javax.xml.bind.package javadoc for additional common information.

    The usage is subject to the following constraints:
    • If type of the field or the property is a collection type, then the collection item type must be mapped to schema simple type.
           // Examples
           @XmlAttribute List<Integer> items; //legal
           @XmlAttribute List<Bar> foo; // illegal if Bar does not map to a schema simple type
       
    • 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.
           // Examples
           @XmlAttribute int foo; // legal
           @XmlAttribute Foo foo; // illegal if Foo does not map to a schema simple type
       
    • This annotation can be used with the following annotations: XmlID, XmlIDREF, XmlList, XmlSchemaType, XmlValue, XmlAttachmentRef, XmlMimeType, XmlInlineBinaryData, XmlJavaTypeAdapter.

    Example 1: Map a JavaBean property to an XML attribute.

         //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>
     

    Example 2: Map a JavaBean property to an XML attribute with anonymous type.

    See Example 7 in @XmlType.

    Example 3: Map a JavaBean collection property to an XML attribute.

         // 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>
    
     
    Since:
    JAXB2.0
    See Also:
    XmlType
    • Element Detail

      • name

        public abstract String name
        Name of the XML Schema attribute. By default, the XML Schema attribute name is derived from the JavaBean property name.
        Default:
        "##default"
      • required

        public abstract boolean required
        Specifies if the XML Schema attribute is optional or required. If true, then the JavaBean property is mapped to a XML Schema attribute that is required. Otherwise it is mapped to a XML Schema attribute that is optional.
        Default:
        false
      • namespace

        public abstract String namespace
        Specifies the XML target namespace of the XML Schema attribute.
        Default:
        "##default"

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-javax/xml/bind/annotation/XmlAttribute.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:fr Manuel PHP : https://docs.oracle.com

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.

Inhoudsopgave Haut