I was searching for the answer through the list but haven't found anything.

I have a class with an attribute of interface type.
@XStreamAlias("given")
public class Given {
       @XStreamAsAttribute
       public String name;
       public Mock mock;
}

Interface is very simple:
@XStreamInclude({ExactMock.class})
public interface Mock {
       void execute();
}

I have implementations of the interface:
@XStreamAlias("exact-mock")
public class ExactMock implements Mock {
       @XStreamAsAttribute
       String endpoint;
       @XStreamAsAttribute
       String name;

       @Override
       public void execute() {
             // TODO Auto-generated method stub
       }
}

It is easy to marshal as:
<given that="My entry condition">
       <mock type="exact-mock"/>
</given>

Given the above class structure (type annotations are part of my experiments) I 
would like to receive below XML structure:
<given that="My entry condition">
       <exact-mock endpoint="my-endpoint" name="name-so-so" />
</given>

Important is to put aliases to element names but not any attribute. I have 
attempt to make own converter but I would like to change main element 
generation only. My implementations of interface would radically vary so rest 
of marshall / unmarshall I would like to delegate to XStream again. It should 
allow to write interface implementations without change of converter. Is it 
possible?

Kind regards
Marcin Stefaniuk
Starszy programista

[cid:image001.gif@01CDB211.7515E610]
PKO Bank Polski
Departament Rozwoju Aplikacji Sprzedażowych i Wsparcia
Wydział Integracji Procesów i Usług
02-515 Warszawa, ul. Puławska 15
t: 22 580 30 39

Dbaj z nami o środowisko!
Nie drukuj tej wiadomości, ani innych dokumentów, jeśli nie jest to konieczne.

<<inline: image001.gif>>

Reply via email to