title: How to attach a XStream converter just for a certain element?
body: <p>It is easy to set a converter for a certain type (<a href="http://x-stream.github.io/javadoc/com/thoughtworks/xstream/XStream.html" rel="nofollow noreferrer">http://x-stream.github.io/javadoc/com/thoughtworks/xstream/XStream.html</a> gives an example):</p>
  
  <pre><code>xstream.registerConverter(new SqlTimestampConverter());
  xstream.registerConverter(new DynamicProxyConverter());
  </code></pre>
  
  <p>I would like to register a converter, but on different element names. The Converter interface does not offer the name of the element.</p>
  
  <p>For example: A date should be converted to a detailed string if the element name (property name) will be in <code>&lt;longDate&gt;</code> but short if in <code>&lt;shortDate&gt;</code>. How can I add different converters based on the property name? Something like xstream.registerConverter( Class classtype, propertyname, converter ) didn't exist but would be nice.</p>
  
  <p>I know that I can use a specialised version of a PrettyPrintWriter but that seems to much work for this simple job. Any other ideas?</p>
  
  <p>BTW: I could use an annotation @XStreamConverter(XXX.class) but I don't want to use annotations. I want my bean free of any annotation.</p>