I am trying to have a domain object container and use the instantiator to create the domain objects. The problem is that I get a “no such constructor” message.
Here is a code snippet (let me know if I should come with a full repro case).
@CompileStatic
class ModelleratorExtension {
final Property<String> toolVersion
final Property<String> ontologyType
final ListProperty<String> modelAspects
final NamedDomainObjectContainer<GeneratedArtifactConfig> generatedArtifacts
ModelleratorExtension(Project project) {
this.toolVersion = project.objects.property(String)
this.ontologyType = project.objects.property(String)
this.modelAspects = project.objects.listProperty(String)
this.generatedArtifacts = project.container(GeneratedArtifactConfig) { name ->
def ga = project.objects.newInstance(GeneratedArtifactConfig, name)
ga.ontologyType.set(ontologyType)
ga.modelAspectTypes.set(modelAspects)
return ga
}
}
void generatedArtifacts(Closure config) {
generatedArtifacts.configure(config)
}
}
@CompileStatic
class GeneratedArtifactConfig {
final String name
final Property<String> ontologyType
final ListProperty<String> modelAspectTypes
final RegularFileProperty template
final Property<TextResource> entities
final ListProperty<GeneratedArtifactConfig> dependsOn
@Inject
GeneratedArtifactConfig(String name, ObjectFactory obf, ProjectLayout prl) {
this.name = name
ontologyType = obf.property(String)
modelAspectTypes = obf.listProperty(String)
template = prl.fileProperty()
entities = obf.property(TextResource)
dependsOn = obf.listProperty(GeneratedArtifactConfig)
}
}