2017-09-21 19 views
0

xjb 상속 바인딩을 simpleType에 적용하는 데 문제가 있습니다. complexType에 적용하면 문제가없는 것 같습니다.JAXB2 용 상속 플러그인이 simpleTypes에서 작동하지 않습니다.

내가 오류는 다음과 같습니다

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

, 어떤 시도를

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

내 바인딩

는 다음과 같이 이 플러그인을 적용하면 simpleType에 수정 사항이 적용되지 않습니다. 상속 플러그인에서 simpleType을 지원하지 않습니까?

답변

1

저자 또는 상속 플러그인은 여기에 있습니다.

플러그인은 간단한 유형을 처리하지 않습니다.

XJC는 실수로 파생 된 단순 유형의 클래스를 생성하지는 않습니다 (필연적으로). 따라서 mypackage.CheckOut 또는 mypackage.CheckIn이 생성되지 않을 수도 있습니다. 따라서 implements mypackage.MyElement을 추가 할 수업이 없습니다.