jaxb-tools
jaxb-tools copied to clipboard
XML Element Wrapper enhancements (keep, etc)
- [x] Support lazy instantiation of collection lists in 'replaced' code
- [x] Support deleting unused collection-classes
- [ ] Support keeping certain classes when deleting unused collection-classes is enabled (aka 'control' file list of classes and behavior
Sample config from other xew plugins (ref: https://github.com/dmak/jaxb-xew-plugin):
<arg>-Xxew</arg>
<arg>-Xxew:control items-schema.xew</arg>
<arg>-Xxew:instantiate lazy</arg>
<arg>-Xxew:collection java.util.LinkedList</arg>
Schema snippet:
<element name="Items">
<sequence>
<element name="Item" type="foo:Item" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<element>
Creates:
com.company.Items;
com.company.Item;
- When 'control' is enabled, the Items class is deleted
- When control file has 'com.company.Items=keep' listed, the class is not deleted
Support lazy instantiation of collection lists in 'replaced' code
Already available with -XelementWrapper:instantiate <EAGER/LAZY>
parameter
Support deleting unused collection-classes
Same here with this parameter -XelementWrapper:delete
(if I understand it well)
See documentation of plugin here : https://github.com/highsource/jaxb-tools/wiki/JAXB-XML-ElementWrapper-Plugin
xew key features:
Part 1. Remove inner collection wrapper-only classes (ie. 'items') Part 2. Delete unused wrapper-only classes
Use cases for 'keep' (ie sometimes do not do part 2):
[Scenario 1] Remove collection-only wrapper object (double wrapper) and delete unused wrapper-only class
Part 1: :white_check_mark: List<Item> itemsList = order.getItems() :x: Items itemsWrapper = order.getItems() :x: List<Item> itemsList = itemsWrapper.getItems()
Part 2: :white_check_mark: Delete the Items class
[Scenario 2] 'keep' the wrapper-only object for this when we need a 'wrapper' for SOAP/REST return payload Part 1, but not Part 2: :white_check_mark: List<Item> itemsList = order.getItems() :white_check_mark: Items itemsWrapper = OrderServce.getOrderItems(String orderId);