Groovy: не удалось найти соответствующий конструктор - PullRequest
0 голосов
/ 23 марта 2020

Может кто-нибудь помочь мне решить, почему я получаю эту ошибку времени выполнения (не могу найти соответствующий конструктор) для следующего класса (JobStage). Я попытался создать экземпляр следующего класса, но это приводит к следующей ошибке во время выполнения.

class JobStage {
    String name
    StageType stageType
    String transformationType
    List<ImField> fields
    TableAttribute tableAttributes
    List<Connector> inputConnectors
    List<Connector> outputConnectors
    JobStageProperties stageProperties

    JobStage(String name, StageType stageType, String transformationType,
              List<ImField> fields,TableAttribute tableAttributes, List<Connector> inputConnectors,
             List<Connector> outputConnectors, JobStageProperties stageProperties){

        this.name = name
        this.stageType = stageType
        this.transformationType = transformationType
        this.fields = fields
        this.tableAttributes = tableAttributes
        this.inputConnectors = inputConnectors
        this.outputConnectors = outputConnectors
        this.stageProperties = stageProperties
    }
}


groovy.lang.GroovyRuntimeException: Could not find matching constructor for: com.starling.informatica.dto.jobstage.JobStage(String, com.starling.informatica.dto.StageType, String, ArrayList, null, ArrayList, com.starling.informatica.dto.stageProperties.SourceRelationalStageProperties)

Ошибка здесь предполагает класс TableAttribute как null и igonres List<Connector> outputConnectors аргумент

Я пытался создать экземпляр так:

JobStageProperties stageProperties = TeradataSpecUtil.getSourceStageProperties()
List<ImField> fields = [new SourceField("integer","","customer_id","NULL","","10","0","","1","NOT A KEY","0","ELEMITEM","NO","11","0","0","0","10","0",""),
 new SourceField("varchar","","customer_name","NULL","","50","0","","2","NOT A KEY","0","ELEMITEM","NO","0","0","0","11","50","10","")
]
List<Connector> inputConnectors = []
List<Connector> outputConnectors = [new Connector("customer_id","informatica_customer_source","Source Definition","customer_id","SQ_informatica_customer_source" ,"Source Qualifier"),
 new Connector("customer_name","informatica_customer_source","Source Definition","customer_name","SQ_informatica_customer_source" ,"Source Qualifier")
]
TableAttribute tableAttribute = null
List<JobStage> expectedJobStage= [new JobStage("informatica_customer_source",
 StageType.TERADATA_CONNECTOR, "Source Definition", fields,tableAttribute, inputConnectors,
 outputConnectors, stageProperties)]

1 Ответ

0 голосов
/ 26 марта 2020

Мой код логически правильный, проблема была с Intellij. Код успешно запустился после того, как я выполнил «Invalidate Caches and Restart».

...