jmapper-core icon indicating copy to clipboard operation
jmapper-core copied to clipboard

How to map single object to nested object

Open jaxkodex opened this issue 7 years ago • 0 comments

Hi,

I am trying to map to a object that contains a nested object that has the same source as the main object, for example:

public class ClassA {
  private String message;
  private NestedClass nested;
}
public class NestedClass {
  private String value;
}
public class ClassB {
  private String message;
  private String nestedValue;
}

And i'd like to map a.message = b.message and a.nested.value = b.nestedValue so my current xml is like:

<jmapper>
  <class name="ClassA">
    <attribute name="message" />
    <attribute name="nested.value">
        <value name="${nestedValue}" />
    </attribute>
  <\class>
<\jmapper>

Currently I am getting the following error:

XmlMappingAttributeDoesNotExistException: nested.value field does not exist in ClassA Class.

Thanks in advance

jaxkodex avatar Jun 28 '18 16:06 jaxkodex