Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapping a flat source to a nested destination not working #89

Open
rajalingams opened this issue Jan 20, 2020 · 0 comments
Open

Mapping a flat source to a nested destination not working #89

rajalingams opened this issue Jan 20, 2020 · 0 comments

Comments

@rajalingams
Copy link

rajalingams commented Jan 20, 2020

I am trying to convert the flat source to the nested destination structure using a single jmapper instance with an xml configuration.

My source class:

class Source {
    String name;
    Integer age;
    String city;
}

My destination classes:

class Destination {
    String fullName;
    PersonalInfo personalInfo;
}
class PersonalInfo {
    Integer age;
    String location;
}

XML configuration:

<jmapper>
    <class name="Destination">
        <attribute name="fullName">
            <value name="name"/>
        </attribute>
        <attribute name="personalInfo">
            <value name="${}"/>
        </attribute>
    </class>
    <class name="PersonalInfo">
        <attribute name="age">
            <value name="age"/>
        </attribute>
        <attribute name="location">
            <value name="city"/>
        </attribute>
    </class>
</jmapper>

"${}" is not working. I know that it works if the source also has an encapsulated class and it can be passed in. Is there a way to pass the original instance as a whole to personalInfo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant