Some questions about JAXB bindings. [message #1807307] |
Mon, 27 May 2019 23:12 |
Eclipse User |
|
|
|
Up until now my experience with eclipse link has been statically mapping bean properties to XPath and the occasional JavaXMLTypeAdapter in order to control the format of a properties value.
Now I've been given the task to map a DOM that was explicitly constructed procedurally and so it's not a 1:1 mapping but more conditions involved.
I have to construct XML that looks like this.
<A>
<B>
<C>
<D>
bean elements.
....
when I have
@XmlRootElement(name="A")
Q1. how can I avoid declaring the full path for each of my bean elements? Since they all will appear under D or lower.
....
Q2. I have to do conditional logic based on a beans properties
so depending on securityType attribute I have to emit
either
when securityType is set to OPT
<SecurityType>
<Option Value="OPT">
<PutCall Value="1"/>
<Maturity>
<MonthYear>201810</MonthYear>
<Day>26</Day>
</Maturity>
<StrikePx>161.5</StrikePx>
</Option>
</SecurityType>
when securityType is set to FUT
<SecurityType>
<Future Value="FUT">
<Maturity>
<MonthYear>201810</MonthYear>
<Day>26</Day>
</Maturity>
</Future>
</SecurityType>
Q3. Another conditional scenario I have is
based on the value of orderType I have to do emit
when orderType = 1
<OrderType>
<MarketOrder Value="1">
</MarketOrder>
</OrderType>
when orderType = 2
<OrderType>
<LimitOrder Value="2">
<Price>0.08</Price>
</LimitOrder>
</OrderType>
when orderType = 3
<OrderType>
<StopOrder Value="3">
<StopPx>0.08</StopPx>
</StopOrder>
</OrderType>
when orderType = 4
<OrderType>
<StopLimitOrder Value="4">
<StopPx>0.08</StopPx>
<Price>0.08</Price>
</StopLimitOrder>
</OrderType>
|
|
|
Powered by
FUDForum. Page generated in 0.03116 seconds