Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Dali/Indigo/JAXB 2.x/PackageAnnotations"
Line 64: | Line 64: | ||
[http://download.oracle.com/javase/6/docs/api/javax/xml/bind/annotation/XmlNs.html @XmlNs] is used within an @XmlSchema annotation to provide prefix information for namespaces used in instance documents. | [http://download.oracle.com/javase/6/docs/api/javax/xml/bind/annotation/XmlNs.html @XmlNs] is used within an @XmlSchema annotation to provide prefix information for namespaces used in instance documents. | ||
− | namespaceURI - namespace to be given prefix | + | *namespaceURI - namespace to be given prefix |
− | + | *prefix - prefix to be used | |
− | prefix - prefix to be used | + | |
=== @XmlAccessorType === | === @XmlAccessorType === | ||
Line 72: | Line 71: | ||
[http://download.oracle.com/javase/6/docs/api/javax/xml/bind/annotation/XmlAccessorType.html @XmlAccessorType] is used on a package or a type to indicate the access type for mappings within JAXB classes. If used on a package, it specifies the default access type for classes within the package. | [http://download.oracle.com/javase/6/docs/api/javax/xml/bind/annotation/XmlAccessorType.html @XmlAccessorType] is used on a package or a type to indicate the access type for mappings within JAXB classes. If used on a package, it specifies the default access type for classes within the package. | ||
− | value - XmlAccessType; default value is PUBLIC_MEMBER | + | *value - XmlAccessType; default value is PUBLIC_MEMBER |
=== @XmlAccessorOrder === | === @XmlAccessorOrder === | ||
Line 78: | Line 77: | ||
[http://download.oracle.com/javase/6/docs/api/javax/xml/bind/annotation/XmlAccessorOrder.html @XmlAccessorOrder] is used on a package or a type to indicate the XML instance order of properties and fields that are mapped to XML elements (XML attributes are unordered by nature). If used on a package, it specifies the default access order for classes within the package. | [http://download.oracle.com/javase/6/docs/api/javax/xml/bind/annotation/XmlAccessorOrder.html @XmlAccessorOrder] is used on a package or a type to indicate the XML instance order of properties and fields that are mapped to XML elements (XML attributes are unordered by nature). If used on a package, it specifies the default access order for classes within the package. | ||
− | value - XmlAccessOrder; default value is UNDEFINED | + | *value - XmlAccessOrder; default value is UNDEFINED |
=== @XmlSchemaType/Types === | === @XmlSchemaType/Types === | ||
Line 84: | Line 83: | ||
[http://download.oracle.com/javase/6/docs/api/javax/xml/bind/annotation/XmlSchemaType.html @XmlSchemaType] is used on a package, field or method, and allows a custom mapping to a built in XML schema type (or other similar simple atomic types). When used on a package, it becomes the default for all mappings using that type in the package. | [http://download.oracle.com/javase/6/docs/api/javax/xml/bind/annotation/XmlSchemaType.html @XmlSchemaType] is used on a package, field or method, and allows a custom mapping to a built in XML schema type (or other similar simple atomic types). When used on a package, it becomes the default for all mappings using that type in the package. | ||
− | name - String; specifies the name of the datatype | + | *name - String; specifies the name of the datatype |
− | namespace - String; specifies the namespace of the datatype; default is the XML schema namespace ("http://www.w3.org/2001/XMLSchema") | + | *namespace - String; specifies the namespace of the datatype; default is the XML schema namespace ("http://www.w3.org/2001/XMLSchema") |
− | type - Class; specifies the java type which uses the given datatype; must be specified when annotation is used at the package level | + | *type - Class; specifies the java type which uses the given datatype; must be specified when annotation is used at the package level |
[http://download.oracle.com/javase/6/docs/api/javax/xml/bind/annotation/XmlSchemaTypes.html @XmlSchemaTypes] is used a container for multiple @XmlSchemaType annotations. | [http://download.oracle.com/javase/6/docs/api/javax/xml/bind/annotation/XmlSchemaTypes.html @XmlSchemaTypes] is used a container for multiple @XmlSchemaType annotations. |
Revision as of 16:03, 7 October 2010
Functional Specification: JAXB Package Annotations
[enter bug location here]
Document History
Date | Author | Version Description & Notes |
---|---|---|
10-6-2010 | Paul Fullbright | Draft |
Feature overview
This feature is about support for JAXB package annotations
Goals:
- Support the ability to annotate packages
- Support JAXB package level annotations and default values
- @XmlSchema
- @XmlNs
- @XmlAccessorType
- @XmlAccessorOrder
- @XmlSchemaType/Types
- Support JAXB package level enums
- XmlNsForm
- XmlAccessType
- XmlAccessOrder
Concepts
Package annotations could conceivably be placed on a package declaration of any class within a package, but in truth, in eclipse, it is only possible to annotate the package-info.java file. Annotating any other package declaration leads to a compile error. In addition, it is extremely unlikely that any externally compiled classes (e.g. jars) come from anything other than file-system-based java implementations, and so extremely unlikely that we'll have to deal with anything other than package annotations only being on the package-info "class".
Dali does not currently support package-info.java annotations, so that is the first technical hurdle. However, much has already been done in bug 265087.
References
Java Language Specification: Packages
Bug 265087: Package-level annotations support
Requirements / Functionality
Support package level annotations
See above comments and reference
@XmlSchema
@XmlSchema is used on a package to declare its namespace and any prefixes to be used for included namespaces. This can be used with the above described namespace-to-schema map to validate mappings within this package and eventually to help users edit mapping information. It also includes information for whether attributes and elements are to be prefixed in instance documents.
- namespace - String; specifies target namespace URI to be used for XML instances representing this package; default value is no namespace
- xmlns - @XmlNs array; specifies prefixes for namespaces involved in XML instances representing this package; default is no prefixes
- location - String; specifies location of (previously generated) schema; default is no location
- attribute/elementFormDefault - XmlNsForm; specifies whether XML instances should have attributes/elements prefix qualified; default is UNSET
@XmlNs
@XmlNs is used within an @XmlSchema annotation to provide prefix information for namespaces used in instance documents.
- namespaceURI - namespace to be given prefix
- prefix - prefix to be used
@XmlAccessorType
@XmlAccessorType is used on a package or a type to indicate the access type for mappings within JAXB classes. If used on a package, it specifies the default access type for classes within the package.
- value - XmlAccessType; default value is PUBLIC_MEMBER
@XmlAccessorOrder
@XmlAccessorOrder is used on a package or a type to indicate the XML instance order of properties and fields that are mapped to XML elements (XML attributes are unordered by nature). If used on a package, it specifies the default access order for classes within the package.
- value - XmlAccessOrder; default value is UNDEFINED
@XmlSchemaType/Types
@XmlSchemaType is used on a package, field or method, and allows a custom mapping to a built in XML schema type (or other similar simple atomic types). When used on a package, it becomes the default for all mappings using that type in the package.
- name - String; specifies the name of the datatype
- namespace - String; specifies the namespace of the datatype; default is the XML schema namespace ("http://www.w3.org/2001/XMLSchema")
- type - Class; specifies the java type which uses the given datatype; must be specified when annotation is used at the package level
@XmlSchemaTypes is used a container for multiple @XmlSchemaType annotations.