为XmlObject提供参数SchemaType [英] Provide parameter SchemaType for XmlObject

查看:70
本文介绍了为XmlObject提供参数SchemaType的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类似

public class CreditCardDocumentImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements creditcard.CreditCardDocument
{

   public CreditCardDocumentImpl(org.apache.xmlbeans.SchemaType sType)
   {
       super(sType);
   }
}

该类正在实现"CreditCardDocument"接口.

That class is implementing "CreditCardDocument" interface.

界面就像

public interface CreditCardDocument extends org.apache.xmlbeans.XmlObject
{

现在,如果我想以

CreditCardDocument creditCardDocument = new CreditCardDocumentImpl(CreditCardDocumentImpl.class.instanceType());

它抛出错误

groovy.lang.MissingMethodException: No signature of method: static creditcard.impl.CreditCardDocumentImpl.instanceType() is applicable for argument types: () values: []

我没有得到什么错误.我需要传递给构造函数的参数是什么?

I'm not getting what is the error. What could be the parameter that I need to pass to the constructor?

推荐答案

您是否使用XmlBeans通过CXF生成了这些类?如果是这样,则可能是您的界面提供了具有模式类型的公共静态属性,或者甚至更好,您可以尝试:

Did you generate these classes through CXF using XmlBeans? If so, probably your interface provides a public static property with the schema type, or even better, you can try:

CreditCardDocument creditCardDocument = CreditCardDocument.Factory.newInstance();

这篇关于为XmlObject提供参数SchemaType的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆