jmapper-framework / jmapper-core

Elegance, high performance and robustness all in one java bean mapper
http://jmapper-framework.github.io/jmapper-core
Apache License 2.0
227 stars 41 forks source link

How to map single object to nested object #83

Closed jaxkodex closed 1 year ago

jaxkodex commented 6 years ago

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