How specify realization of interface in xStream?
<p>The XML description of entities "messages".    </p>

<pre><code>&lt;Message id="11600005" name="some_name"&gt;
        &lt;sourcePartitionId&gt;11600&lt;/sourcePartitionId&gt;
        &lt;destPartitionId&gt;11700&lt;/destPartitionId&gt;
        &lt;payloadId&gt;1300005&lt;/payloadId&gt;
        &lt;sourceUdp&gt;1045&lt;/sourceUdp&gt;
        &lt;destUdp&gt;1046&lt;/destUdp&gt;
        &lt;sourceIp&gt;10.4.48.0&lt;/sourceIp&gt;
        &lt;destIp&gt;10.4.49.0&lt;/destIp&gt;
        &lt;sourcePort id="1045" name="sp_q_1045_11600_11700_005"&gt;
            &lt;type&gt;Queuing&lt;/type&gt;
            &lt;maxMessageSize&gt;8192&lt;/maxMessageSize&gt;
            &lt;characteristic&gt;1&lt;/characteristic&gt;
        &lt;/sourcePort&gt;
        &lt;destPort id="1046" name="dp_q_1045_1046_11600_11700_005"&gt;
            &lt;type&gt;Queuing&lt;/type&gt;
            &lt;maxMessageSize&gt;8192&lt;/maxMessageSize&gt;
            &lt;characteristic&gt;1&lt;/characteristic&gt;
        &lt;/destPort&gt;
    &lt;/Message&gt;
</code></pre>

<p>In the fields <code>sourcePort</code> and <code>destPort</code> described object that implements interface <code>ComPort</code>:</p>

<pre><code>public interface ComPort {

    enum PortType {Sampling, Queuing}
    enum PortDirection {Rx,Tx}

    public PortType getPortType();
    public PortDirection getPortDirection();

    public int getMaxMessageSize();
    public int getPortCharacteristic();
</code></pre>

<p>At the interface there are two implementations: <code>SamplingPort</code> and <code>QueuingPort</code>. Both the main difference - characteristic field. Tell me how to make xstream based on <code>&lt;type&gt;</code> tag creates an instance of a corresponding implementation?</p>

<p><em>An important point</em>: It is also necessary to consider that when <code>sourcePort</code> tag - direction field is <code>Tx</code>, and when <code>destPort</code> tag - direction field is <code>Rx</code></p>