You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Mond Raymond <mo...@gmail.com> on 2010/08/24 14:10:48 UTC

camel-xstream ... package aliasing possible?

I see the source and the JIRA reflecting the fact that the code should
support more Xstream converters / aliases.  All good. 

One small thing... I would just like to tweak the output to tweak the
package name. 

In Xstream I can do the following: 

        XStream xstream = new XStream(); 
        xstream.aliasPackage("com", "com.blah.blah"); 

Although I cannot find a direct way to do this in the API, is there a
possibility with a bit of hacking to achieve this result?  Essentially I
would like to provide my own xstream instance... 

Thanks in advance 

Ray 
-- 
View this message in context: http://camel.465427.n5.nabble.com/camel-xstream-package-aliasing-possible-tp2651116p2651116.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-xstream ... package aliasing possible?

Posted by Willem Jiang <wi...@gmail.com>.
Here is an example from the camel-xstream unit test.

XStreamDataFormat xstreamDefinition = new XStreamDataFormat();
Map<String, String> aliases = new HashMap<String, String>();
aliases.put("purchase-order", PurchaseOrder.class.getName());
xstreamDefinition.setAliases(aliases);

  List<String> converters = new ArrayList<String>();
  converters.add(PurchaseOrderConverter.class.getName());
  converters.add(CheckMethodInjection.class.getName());
  converters.add(CheckConstructorInjection.class.getName());

xstreamDefinition.setConverters(converters);

from("direct:marshal").marshal(xstreamDefinition).to("mock:result");
 
from("direct:unmarshal").unmarshal(xstreamDefinition).to("mock:result");

Willem

Mond Raymond wrote:
> I see the source and the JIRA reflecting the fact that the code should
> support more Xstream converters / aliases.  All good. 
> 
> One small thing... I would just like to tweak the output to tweak the
> package name. 
> 
> In Xstream I can do the following: 
> 
>         XStream xstream = new XStream(); 
>         xstream.aliasPackage("com", "com.blah.blah"); 
> 
> Although I cannot find a direct way to do this in the API, is there a
> possibility with a bit of hacking to achieve this result?  Essentially I
> would like to provide my own xstream instance... 
> 
> Thanks in advance 
> 
> Ray