我试图在groovy文件中调用构造函数。我有一个像
public class CreditCardDocumentImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements creditcard.CreditCardDocument
{
// Constructor
public CreditCardDocumentImpl(org.apache.xmlbeans.SchemaType sType)
{
super(sType);
}
}
当我尝试通过调用访问构造函数时,
// Call the constructor
CreditCardDocument creditCardDocument = new CreditCardDocumentImpl(SchemaType);
它不允许我
groovy.lang.GroovyRuntimeException: Could not find matching constructor for: creditcard.impl.CreditCardDocumentImpl(java.lang.Class)
任何想法将不胜感激。
最佳答案
您应该传递SchemaType的实例,而不是类本身。
CreditCardDocument creditCardDocument = new CreditCardDocumentImpl(new SchemaType());