Skip to content
This repository has been archived by the owner on Mar 15, 2022. It is now read-only.

Mapping of fields to attributes not working in subclasses #2

Open
hpehl opened this issue Oct 29, 2012 · 0 comments
Open

Mapping of fields to attributes not working in subclasses #2

hpehl opened this issue Oct 29, 2012 · 0 comments
Assignees
Milestone

Comments

@hpehl
Copy link
Owner

hpehl commented Oct 29, 2012

What steps will reproduce the problem?

  1. I declare an Xmlreader for the class Obj this way:
@Mappings({
    @Mapping( value="display", path="@display"),
    @Mapping( value="displayName", path="@displayName"),
    @Mapping( value="href", path="@href", convert= UriConverter.class),
    @Mapping( value="icon", path="@icon", convert= UriConverter.class),
    @Mapping( value="is", path="@is", convert = ContractConverter.class),
    @Mapping( value="isNull", path="@isNull"),
    @Mapping( value="name", path="@name"),
    @Mapping( value="status", path="@status"),
    @Mapping( value="writable", path="@writable"),
    @Mapping( value="childrens", path="child::*", createWith= ObjCreator.class)
})
public interface ObjXmlReader extends XmlReader<Obj>{}
  1. I declare an XmlReader for class OP ( Op extends Obj) this way:
@Mappings({
    @Mapping( value="in", path="@in", convert= ContractConverter.class),
    @Mapping( value="out", path="@out", convert= ContractConverter.class)
})
public interface OpXmlReader extends XmlReader<Op>{}
  1. What is the expected output? What do you see instead?
    OpXmlReader should be able to mapp fields to associates xml attributes ( Pojo ->Xml). It doesn't.
    In function readProperties(..) of OpXmlReaderImpl I see: value = element.selectValue("display",REMOVE),
    but in readProperties(..) of ObjXmlReaderImpl the same line is : value = element.selectValue("@display",REMOVE).

It look like in subClasses, Piriti forgot that the class files was mapped to an attribute of the current element, and instead look for an child element ...

As a result I can't mapp any attributes to subclasses of class Obj.

What version of the product are you using? On what operating system?

Pririti 0.8, Restlet 2.05, Gwt 2.4, Windows XP, Firefox 3.6

https://code.google.com/p/piriti/issues/attachmentText?id=58&aid=580002001&name=Op.java&token=NNIGCtYwlCdmNqfxfDZ_uyyaKcU%3A1351504668855
https://code.google.com/p/piriti/issues/attachmentText?id=58&aid=580002000&name=Obj.java&token=H3VR7g2Mkbdgm-YHrhtQr62Smjg%3A1351504668855

@ghost ghost assigned hpehl Oct 29, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant