|
|
|
[
Permlink
| « Hide
]
Joerg Schaible - 03/Mar/06 01:40 AM
It also does not honor the new alias mechanism for fields. Now that we have an AbstractReflectionConverter, we can maybe refactore the code even more to support both issues with one code base.
This is a quick patch for SerializableConverter
I ran into this issue today while trying to be explicit about the XML serialization of one of my domain objects. I, much like this issue states, cannot omit fields from the XStream object, for example:
XStream xs = new XStream(); if(entity instanceof Metadata ) { xs.omitField(Project.class, "project"); // TODO http://jira.codehaus.org/browse/XSTR-280 //$NON-NLS-1$ xs.omitField(MetadataValue.class, "metadataValues"); // TODO http://jira.codehaus.org/browse/XSTR-280 //$NON-NLS-1$ } String xml = xs.toXML(entity); The resulting string will contain the elements <project>...</project> and <metadataValues>...</metadataValues> What I would like is the resulting XML string to *not* serialize these attributes into XML; rather omit them from the final XML string. I compiled the Patch in and it still does not have the proper result .... there is no omission of XML elements when using:
xStream.omitField(MyClass.class, "myClassProperty"); This is a quick patch for JavaBeanConverter
A simple test to check if javabean respects the omitted fields
Modified patch with fixes for inheritance of omitted fields and field aliases
The patch for the JavaBeanConverter has been applied.
Alias and omit field is now also respected by the SerializableConverter.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||