You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 15, 2022. It is now read-only.
I am using Piriti on a Restlet / Gwt project fro sole time now. I had a probleme while serializing a list of objects ex: List with the objects in the list all extending the original type. In the XML produced I need to have the list elements with theirs tag name to be the name of the extending class. Actually the list elements names are derived from the list name ....
Per example I have a List, and objects Volkswagen, Saab and Renault all extend Car. Say I have such a list and objects Volkswagen, Saab and Renault in it. I'll need the poduced XMl to look like:
To manage that, I had to modify the Velocity templates in pririt-dev, in /src/main/resources/name.pehl.pririti.rebind.xml.writer.property.collection.vm, begining in lines 20, from
This way, if in a XMLWrtiter mapping for a collection element, I do not indicate the path, the class name of each collection element is used as the name of the tage, example: @mapping( value="childrens", path="" ),
I do not have the same problem with the XMLReader part, because I can use this expression: @mapping( value="childrens", path="child::*", createWith= ObjCreator.class),
Do you think it is something we could push back into piriti ?
Thanks
Laurent.
The text was updated successfully, but these errors were encountered:
I am using Piriti on a Restlet / Gwt project fro sole time now. I had a
probleme while serializing a list of objects ex: List with the objects in
the list all extending the original type. In the XML produced I need to
have the list elements with theirs tag name to be the name of the extending
class. Actually the list elements names are derived from the list name ....
Per example I have a List, and objects Volkswagen, Saab and Renault all
extend Car. Say I have such a list and objects Volkswagen, Saab and Renault
in it. I'll need the poduced XMl to look like:
To manage that, I had to modify the Velocity templates in pririt-dev, in
/src/main/resources/name.pehl.pririti.rebind.xml.writer.property.collection.vm,
begining in lines 20, from
This way, if in a XMLWrtiter mapping for a collection element, I do not
indicate the path, the class name of each collection element is used as the
name of the tage, example: @mappinghttps://github.com/Mapping( value="childrens", path="" ),
I do not have the same problem with the XMLReader part, because I can use
this expression: @mappinghttps://github.com/Mapping( value="childrens",
path="child::*", createWith= ObjCreator.class),
Do you think it is something we could push back into piriti ?
Thanks
Laurent.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/10
.
Hello Harald,
I am using Piriti on a Restlet / Gwt project fro sole time now. I had a probleme while serializing a list of objects ex: List with the objects in the list all extending the original type. In the XML produced I need to have the list elements with theirs tag name to be the name of the extending class. Actually the list elements names are derived from the list name ....
Per example I have a List, and objects Volkswagen, Saab and Renault all extend Car. Say I have such a list and objects Volkswagen, Saab and Renault in it. I'll need the poduced XMl to look like:
To manage that, I had to modify the Velocity templates in pririt-dev, in /src/main/resources/name.pehl.pririti.rebind.xml.writer.property.collection.vm, begining in lines 20, from
if (currentValue != null)
{
#parse($property.templates.elementType)
}
else
{
collectionXmlBuilder.append(nestedPath);
}
to:
if (currentValue != null)
{
#if (!$property.xpath)
String nestedElementName = currentValue.getClass().getName();
nestedPath = nestedElementName.substring(nestedElementName.lastIndexOf(".")+1).toLowerCase();
#end
#parse($property.templates.elementType)
}
else
{
collectionXmlBuilder.append("$property.pathOrName");
}
This way, if in a XMLWrtiter mapping for a collection element, I do not indicate the path, the class name of each collection element is used as the name of the tage, example:
@mapping( value="childrens", path="" ),
I do not have the same problem with the XMLReader part, because I can use this expression:
@mapping( value="childrens", path="child::*", createWith= ObjCreator.class),
Do you think it is something we could push back into piriti ?
Thanks
Laurent.
The text was updated successfully, but these errors were encountered: