[
https://issues.jboss.org/browse/SHRINKDESC-163?page=com.atlassian.jira.pl...
]
Bob McWhirter commented on SHRINKDESC-163:
------------------------------------------
I think a combination of adding a super-interface and some smarts around parsing.
Here's how I'm currently working-around:
https://github.com/wildfly-swarm/wildfly-swarm-fraction-plugin/blob/maste...
Basically parse into generic Nodes, inspect the root element, and then wrap that Node tree
in the correct descriptor impl.
If we could do something like Descriptors.create( BaseModuleDescriptor.class, ....) which
would do what I've done, returning some sub-class of BaseModuleDescriptor
(ModuleAliasDescriptor, ModuleDescriptor, whatnot) then I could easily jam them into the
same collection with no problem, and instanceof/downcast as necessary to get the actual
leaf.
Bonus points if common attributes (name? slot?) could be floated up to the common super
interface.
Deal with descriptors with multiple possible roots better
---------------------------------------------------------
Key: SHRINKDESC-163
URL:
https://issues.jboss.org/browse/SHRINKDESC-163
Project: ShrinkWrap Descriptors
Issue Type: Feature Request
Affects Versions: 2.0.0-alpha-8
Reporter: Toby Crawley
Assignee: Ralf Battenfeld
When implementing SHRINKDESC-162, I created three different
descriptors for module.xml ({{ModuleDescriptor}},
{{ModuleAliasDescriptor}}, {{ModuleAbsentDescriptor}}) corresponding to
the three root elements listed in the xsd ({{module}}, {{module-alias}},
{{module-absent}}). This works fine if you are generating a module.xml,
but if you are loading in an existing file, you don't know without
looking at the file contents to know which type to instantiate.
It would be swell if there was a way for descriptors to support
multiple roots and do the correct thing. Or does that already exist
and I missed it?
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)