Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

How Using MapStruct to generate mappingclass due to annotation

I have a service class, in this class from DTO it will be mapped to th DomainModel.

so i want to use framework MapStruct togenerate Mapping-Class due to annimation.

My service class hast that method:

  private void dtoToDomain(final Kapitalertraege2013DTO dto, final KapitalertragsteuerEStGBase kapitalertragsteuer) {
    AbstractKapitalertraegeBase ertraege = kapitalertragsteuer.getKapitalertraege();

    if (!(ertraege instanceof Kapitalertraege2012)) {
        throw new IllegalArgumentException("Falsche Kapitalertragsteuer Implementierung [" + ertraege.getClass().getName()
                + "]");
    }

    Kapitalertraege2012 ertraege2012 = (Kapitalertraege2012) ertraege;

    new SteuerabzugP43Abs1S1Nr1EStGService().uebernehme(dto, ertraege2012);
    new SteuerabzugP43Abs1S1Nr1aEStGService().uebernehme(dto, ertraege2012);
    new SteuerabzugP43Abs1S1Nr1und2bis4und7aEStGService().uebernehme(dto, ertraege2012);
    new SteuerabzugP43aAbs1S1Nr2EStGService().uebernehme(dto, ertraege2012);
    new SummenSteuerabzugUndErstattungService().uebernehme(dto, ertraege2012);
    new ErstattungP44aAbs6EStGService().uebernehme(dto, ertraege2012);

    BeschlussvorlageType beschlussvorlage = dto.getBeschlussvorlageType();
    if (beschlussvorlage != null) {
        ((Beschlussvorlage) ertraege).setBeschlussvorlage(beschlussvorlage.getBooleanWert());
    }

    if (LOGGER.isTraceEnabled()) {
        LOGGER.trace("## dtoToDomain #######");
        LOGGER.trace("dto: " + dto);
        LOGGER.trace("######################");
        LOGGER.trace("domain: " + ertraege);
        LOGGER.trace("######################");
    }
}

How can i do that?!

Comments