Search in sources :

Example 1 with Label

use of org.mapstruct.ap.test.nestedsourceproperties.source.Label in project mapstruct by mapstruct.

the class ChartEntryToArtistImpl method chartEntryToLabel.

protected Label chartEntryToLabel(ChartEntry chartEntry) {
    if (chartEntry == null) {
        return null;
    }
    Label label = new Label();
    label.setStudio(chartEntryToStudio(chartEntry));
    return label;
}
Also used : Label(org.mapstruct.ap.test.nestedsourceproperties.source.Label)

Example 2 with Label

use of org.mapstruct.ap.test.nestedsourceproperties.source.Label in project mapstruct by mapstruct.

the class ChartEntryToArtistImpl method chartSongArtistLabelStudioCity.

private String chartSongArtistLabelStudioCity(Chart chart) {
    if (chart == null) {
        return null;
    }
    Song song = chart.getSong();
    if (song == null) {
        return null;
    }
    Artist artist = song.getArtist();
    if (artist == null) {
        return null;
    }
    Label label = artist.getLabel();
    if (label == null) {
        return null;
    }
    Studio studio = label.getStudio();
    if (studio == null) {
        return null;
    }
    String city = studio.getCity();
    if (city == null) {
        return null;
    }
    return city;
}
Also used : Artist(org.mapstruct.ap.test.nestedsourceproperties.source.Artist) Song(org.mapstruct.ap.test.nestedsourceproperties.source.Song) Label(org.mapstruct.ap.test.nestedsourceproperties.source.Label) Studio(org.mapstruct.ap.test.nestedsourceproperties.source.Studio)

Example 3 with Label

use of org.mapstruct.ap.test.nestedsourceproperties.source.Label in project mapstruct by mapstruct.

the class ChartEntryToArtistImpl method chartEntryToArtist1.

protected void chartEntryToArtist1(ChartEntry chartEntry, Artist mappingTarget) {
    if (chartEntry == null) {
        return;
    }
    if (mappingTarget.getLabel() == null) {
        mappingTarget.setLabel(new Label());
    }
    chartEntryToLabel1(chartEntry, mappingTarget.getLabel());
    mappingTarget.setName(chartEntry.getArtistName());
}
Also used : Label(org.mapstruct.ap.test.nestedsourceproperties.source.Label)

Example 4 with Label

use of org.mapstruct.ap.test.nestedsourceproperties.source.Label in project mapstruct by mapstruct.

the class ChartEntryToArtistImpl method chartSongArtistLabelStudioName.

private String chartSongArtistLabelStudioName(Chart chart) {
    if (chart == null) {
        return null;
    }
    Song song = chart.getSong();
    if (song == null) {
        return null;
    }
    Artist artist = song.getArtist();
    if (artist == null) {
        return null;
    }
    Label label = artist.getLabel();
    if (label == null) {
        return null;
    }
    Studio studio = label.getStudio();
    if (studio == null) {
        return null;
    }
    String name = studio.getName();
    if (name == null) {
        return null;
    }
    return name;
}
Also used : Artist(org.mapstruct.ap.test.nestedsourceproperties.source.Artist) Song(org.mapstruct.ap.test.nestedsourceproperties.source.Song) Label(org.mapstruct.ap.test.nestedsourceproperties.source.Label) Studio(org.mapstruct.ap.test.nestedsourceproperties.source.Studio)

Example 5 with Label

use of org.mapstruct.ap.test.nestedsourceproperties.source.Label in project mapstruct by mapstruct.

the class ReversingNestedSourcePropertiesTest method prepareSong.

private Song prepareSong() {
    Studio studio = new Studio();
    studio.setName("Abbey Road");
    studio.setCity("London");
    Label label = new Label();
    label.setStudio(studio);
    label.setName("EMY");
    Artist artist = new Artist();
    artist.setName("The Beatles");
    artist.setLabel(label);
    Song song = new Song();
    song.setArtist(artist);
    song.setTitle("A Hard Day's Night");
    return song;
}
Also used : Artist(org.mapstruct.ap.test.nestedsourceproperties.source.Artist) Song(org.mapstruct.ap.test.nestedsourceproperties.source.Song) ChartEntryLabel(org.mapstruct.ap.test.nestedsourceproperties._target.ChartEntryLabel) Label(org.mapstruct.ap.test.nestedsourceproperties.source.Label) Studio(org.mapstruct.ap.test.nestedsourceproperties.source.Studio)

Aggregations

Label (org.mapstruct.ap.test.nestedsourceproperties.source.Label)9 Artist (org.mapstruct.ap.test.nestedsourceproperties.source.Artist)7 Studio (org.mapstruct.ap.test.nestedsourceproperties.source.Studio)7 Song (org.mapstruct.ap.test.nestedsourceproperties.source.Song)5 ChartEntry (org.mapstruct.ap.test.nestedsourceproperties._target.ChartEntry)2 ProcessorTest (org.mapstruct.ap.testutil.ProcessorTest)2 WithClasses (org.mapstruct.ap.testutil.WithClasses)2 ChartEntryLabel (org.mapstruct.ap.test.nestedsourceproperties._target.ChartEntryLabel)1 Chart (org.mapstruct.ap.test.nestedsourceproperties.source.Chart)1