更改生成的类中的对象类型

时间:2019-12-02 19:34:58

标签: xsd jaxb

我遇到了一个奇怪的问题。我有一个XSD,其输出对象定义如下:

XSD定义  

          <xs:sequence>

                 <xs:element name="Test" type="xs:anyType" minOccurs="1” maxOccurs="1" />

          </xs:sequence>      

   </xs:complexType>

它将生成如下的Java类

公共类输出

implements Serializable

{     私有最终静态长serialVersionUID = 1L;

@XmlElement(name = "Test", required = true)

protected Object test;



/**

 * Gets the value of the loan property.

 *

 * @return

 *     possible object is

 *     {@link Object }

 *    

 */

public Object getTest() {

    return test;

}



/**

 * Sets the value of the loan property.

 *

 * @param value

 *     allowed object is

 *     {@link Object }

 *    

 */

public void setTest(Object value) {

    this.test = value;

}

}

问题:我正在使用在另一个XSD(作为简单类型)中创建的Test对象,因此它没有名称创建(我收到匿名对象封送错误)。

是否可以更改生成的类,使“ test”变量的类型为MyType而不是Object?

这将解决我的封送处理异常。

0 个答案:

没有答案
相关问题