问题
I have a class like
public class CreditCardDocumentImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements creditcard.CreditCardDocument
{
public CreditCardDocumentImpl(org.apache.xmlbeans.SchemaType sType)
{
super(sType);
}
}
That class is implementing "CreditCardDocument" interface.
The interface is like
public interface CreditCardDocument extends org.apache.xmlbeans.XmlObject
{
Now, if I want to access that constructor as
CreditCardDocument creditCardDocument = new CreditCardDocumentImpl(CreditCardDocumentImpl.class.instanceType());
It throws as error,
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?
回答1:
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();
来源:https://stackoverflow.com/questions/27919772/provide-parameter-schematype-for-xmlobject