Show Table of Contents
付録A 付録 A: JAXB Annotation Introduction 設定の記述
JAXB (Java Architecture for XML Binding) Annotation Introduction の設定を作成するのは非常に簡単です。AXB Annotation を理解できていれば、問題なく JAXB Annotation Introduction の設定を記述することができるでしょう。
設定の XSD は、http://anonsvn.jboss.org/repos/jbossws/projects/jaxbintros/tags/1.0.0.GA/src/main/resources/jaxb-intros.xsd にてオンラインで提供されています。IDE にて http://www.jboss.org/xsd/jaxb/intros 名前空間に対してこの XSD を登録します。
現在サポートされているのは 3 つのアノテーションのみです。
- @XmlType (https://jaxb.dev.java.net/nonav/2.1.3/docs/api/javax/xml/bind/annotation/XmlType.html): “Class” 要素
- @XmlElement (https://jaxb.dev.java.net/nonav/2.1.3/docs/api/javax/xml/bind/annotation/XmlElement.html): Field” と “Method” 要素
- @XmlAttribute (https://jaxb.dev.java.net/nonav/2.1.3/docs/api/javax/xml/bind/annotation/XmlAttribute.html): “Field” と “Method” 要素
設定ファイルの基本構成は、(“Fields” と “Methods” が “Class” に含まれるというように) Java クラスの基本構造に準拠しています。<Class>、<Field>、<Method> 要素はすべて“name” 属性を必要とします。この属性は、Class、Field、Method の名前を提供しています。この name 属性の値は正規表現に対応可能です。これにより、1 つの Class 内のフィールドや 1 パッケージ内のすべての Class に名前空間を設定するなど、単一の Annotation Introduction 設定で複数の Class、Field、Member を対象にすることができます。
Annotation Introduction 設定は Annotation の定義と完全に一致し、各アノテーションの要素と値のペアは、Annotation Introduction 設定上の属性によって表されます (XSD と IDE を使用して設定を編集してください)。
最後に例を挙げます。
<?xml version = "1.0" encoding = "UTF-8"?>
<jaxb-intros xmlns="http://www.jboss.org/xsd/jaxb/intros">
<!--
The type namespaces on the customerOrder are
different from the rest of the message...
-->
<Class name="com.activebpel.ordermanagement.CustomerOrder">
<XmlType propOrder="orderDate,name,address,items" />
<Field name="orderDate">
<XmlAttribute name="date" required="true" />
</Field>
<Method name="getXYZ">
<XmlElement
namespace="http://org.jboss.esb/quickstarts/bpel/ABI_OrderManager"
nillable="true" />
</Method>
</Class>
<!-- More general namespace config for the rest of the message... -->
<Class name="com.activebpel.ordermanagement.*">
<Method name="get.*">
<XmlElement namespace="http://ordermanagement.activebpel.com/jaws" />
</Method>
</Class>
</jaxb-intros>
Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.