16.3. JAXB アノテーションの概要設定の作成


設定の XSD は、でオンラインで http://anonsvn.jboss.org/repos/jbossws/projects/jaxbintros/tags/1.0.0.GA/src/main/resources/jaxb-intros.xsd 利用できます。(IDE で、この XSD を namespace に対して登録し http://www.jboss.org/xsd/jaxb/intros ます。)
@XmlType
@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 要素になります。
設定ファイルの基本構造は、Java クラス(つまり、Fields および Methods を含むクラス)に従います。 <Class>、<Field>、および <Method> 要素はすべて name 属性を必要とします。この属性は、クラス、フィールド、またはメソッドの名前を指定します。この name 属性の値は正規表現をサポートできます。これにより、単一のアノテーション導入設定を複数のクラス、フィールド、またはメンバーでターゲットに設定できます。たとえば、クラス内のフィールドに name-space を設定したり、パッケージのすべてのクラスに対して名前スペースを設定したりできます。
アノテーションのIntroduction 設定はアノテーション定義自体と完全に一致します。各アノテーションの element-value pair はアノテーション導入設定の属性によって表されます。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>

Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2026 Red Hat
トップに戻る