This message was deleted.
# native
s
This message was deleted.
d
Starting Gradle 5.3, 5.5 and 6.1, the
ObjectFactory
has factory method to create
[Named|Polymorphic]DomainObject(Set|List|Container)
(since 5.5/6.1) and
ConfigurableFileCollection
(since 5.3). That solve the issue around
DefaultDomainObjectCollectionFactory
and
DefaultFileCollectionFactory
. However, the code linked shows that you are creating more than just those two object. Essentially, you are building
PrebuiltLibrary
instances. I would recommend receiving the instance of
Repositories
via the Software Model so you can create your own
PrebuiltLibraries
and populate it as you want. However, I see the issue you are facing.
PrebuiltLibraries
implements
NamedDomainObjectSet
which means you need to create your own instance to add them to the set (instead of the container counter part where you can use
create
). The documentation further mislead because it shows you can create instance of
PrebuiltLibrary
via the Groovy magic offered by
NamedDomainObjectContainer
. In Java, you won’t be able to replicate because
PrebuiltLibraries
is a
NamedDomainObjectSet
. However the implementation of
PrebuiltLibraries
extends from
NamedDomainObjectContainer
. I believe it’s an oversight and you should be able to cast
PrebuiltLibraries
into
NamedDomainObjectContainer<PrebuiltLibrary>
without issue. Hence, creating prebuilt libraries would just be a matter of calling
create("…")
.
I hope that helps solve your issue.
j
Thank you very much for the valuable information. I'll be in touch again to let you know how it went or to ask more questions. ;)
👍 1