2017-09-21 9 views
0

xjb継承バインディングをsimpleTypeに適用する際に問題があります。それをcomplexTypeに適用するとうまくいくようです。JAXB2の継承プラグインがsimpleTypesで動作しない

私が手にエラーがある:

compiler was unable to honor this implements customization. It is attached to a wrong place, or its inconsistent with other bindings. 

私のバインディングは次のようになります。

<jaxb:bindings version="1.0" 
      xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" 
      xmlns:xs="http://www.w3.org/2001/XMLSchema" 
      xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" 
      xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance" 
      jaxb:extensionBindingPrefixes="xjc"> 
    <jaxb:bindings schemaLocation="../xsd/schema.xsd" node="/xs:schema"> 
    <jaxb:bindings multiple="true" 
        node="//xs:complexType[substring(@name, string-length(@name)-string-length('-e')+1)='-e']"> 
     <inheritance:implements>mypackage.Element</inheritance:implements> 
    </jaxb:bindings> 
    <jaxb:bindings multiple="true" 
        node="//xs:simpleType[descendant::xs:restriction[@base='string']]"> 
     <inheritance:implements>mypackage.Element</inheritance:implements> 
    </jaxb:bindings> 
</jaxb:bindings> 

そして、私のXSDは、次の行が含まれます、結果的にしようとする試みを

<simpleType name="checkOut"> 
      <restriction base="string"/> 
     </simpleType> 
    <simpleType name="checkIn"> 
     <restriction base="string"/> 
    </simpleType> 
<complexType name="Author-e"></complexType> 

をこのプラグインを適用するか、simpleTypeへの変更が失敗します。継承プラグインではsimpleTypesはサポートされていませんか?

答えて

1

作成者または継承プラグインはこちら。

プラグインは単純な型を処理しません。

私が誤解していない場合、XJCは派生した単純型のクラスを(必ず)生成しません。したがって、mypackage.CheckOutまたはmypackage.CheckInが生成されない可能性があります。したがって、implements mypackage.MyElementを追加するクラスはありません。

関連する問題