У меня есть следующий метод, в котором я возвращаю List<ImField>
объект, используя List<GPathResult> filteredList
. Я выполняю закрытие filteredList.each
, где я генерирую класс во время выполнения и присваиваю ему тип ImField
. *1004*.
static List<ImField> getFields(GPathResult root,String fieldClass, String fieldType){
List<GPathResult> filteredList = root.children().findAll{
XMLSlurperUtil.name(it as GPathResult) == fieldType
} as List<GPathResult>
List<ImField> fields = []
filteredList.each{GPathResult it, int index ->
fields.add(Class.forName(fieldClass).newInstance() as ImField)
fields[index].set(it)
}
fields
}
. Вызов функции будет выглядеть так:
ImStageUtil.getFields(root, ImFieldFactory.SOURCE_FIELD, ImParserConstants.SOURCE_FIELD)
, где ImFieldFactory.SOURCE_FIELD = "com.datametica.starling.informatica.dto.fields.SourceField"
и ImParserContants.SOURCE_FIELD = "SOURCEFIELD"
ошибка возникает на линии закрытия .each
:
No signature of method: com.datametica.starling.informatica.extractor.ImStageUtil$_getFields_closure11.doCall() is applicable for argument types: (groovy.util.slurpersupport.NodeChild) values: []
Possible solutions: doCall(groovy.util.slurpersupport.GPathResult, int), findAll(), findAll(), isCase(java.lang.Object), isCase(java.lang.Object)
groovy.lang.MissingMethodException: No signature of method: com.datametica.starling.informatica.extractor.ImStageUtil$_getFields_closure11.doCall() is applicable for argument types: (groovy.util.slurpersupport.NodeChild) values: []
Possible solutions: doCall(groovy.util.slurpersupport.GPathResult, int), findAll(), findAll(), isCase(java.lang.Object), isCase(java.lang.Object)