如果groovy对象从另一个同时具有setProperty方法的类继承,我如何解决在groovy对象上调用的setProperty之间的名称冲突 当我尝试执行以下操作时,我在下面的代码中收到错误,错误发生在粗体上,因为XmlFilterImpl也有类似的setProperty方法
def transitFileProcessorService
def BermudaOutputTransformFilter filter
public void transformBermudaOutput(File bermudaOutputFile)
{
SAXParserFactory spf = SAXParserFactory.newInstance()
SAXParser parser = spf.newSAXParser()
XMLReader reader = parser.getXMLReader()
BermudaOutputTransformFilter filter = new BermudaOutputTransformFilter()
filter.setParent(reader)
**filter.transitFileProcessorService = transitFileProcessorService**
}
class BermudaOutputTransformFilter extends XMLFilterImpl{
def relationshipId
TransitFileProcessorService transitFileProcessorService
}
堆栈跟踪: org.xml.sax.SAXNotRecognizedException:无法识别属性'transitFileProcessorService'。 在com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.getProperty(AbstractSAXParser.java:2060)
答案 0 :(得分:1)
您可以尝试使用
直接访问该媒体资源filter.@transitFileProcessorService = transitFileProcessorService