Search in sources :

Example 1 with Song

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

the class ChartEntryToArtistImpl method chartSongPositions.

private List<Integer> chartSongPositions(Chart chart) {
    if (chart == null) {
        return null;
    }
    Song song = chart.getSong();
    if (song == null) {
        return null;
    }
    List<Integer> positions = song.getPositions();
    if (positions == null) {
        return null;
    }
    return positions;
}
Also used : Song(org.mapstruct.ap.test.nestedsourceproperties.source.Song)

Example 2 with Song

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

the class ChartEntryToArtistImpl method map.

@Override
public Chart map(ChartEntry chartEntry1, ChartEntry chartEntry2) {
    if (chartEntry1 == null && chartEntry2 == null) {
        return null;
    }
    Chart chart = new Chart();
    if (chartEntry1 != null) {
        if (chart.getSong() == null) {
            chart.setSong(new Song());
        }
        chartEntryToSong1(chartEntry1, chart.getSong());
    }
    if (chartEntry2 != null) {
        if (chart.getSong() == null) {
            chart.setSong(new Song());
        }
        chartEntryToSong2(chartEntry2, chart.getSong());
        chart.setName(chartEntry2.getChartName());
    }
    return chart;
}
Also used : Song(org.mapstruct.ap.test.nestedsourceproperties.source.Song) Chart(org.mapstruct.ap.test.nestedsourceproperties.source.Chart)

Example 3 with Song

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

the class ChartEntryToArtistImpl method chartEntryToSong.

protected Song chartEntryToSong(ChartEntry chartEntry) {
    if (chartEntry == null) {
        return null;
    }
    Song song = new Song();
    song.setArtist(chartEntryToArtist(chartEntry));
    song.setTitle(chartEntry.getSongTitle());
    song.setPositions(mapPosition(chartEntry.getPosition()));
    return song;
}
Also used : Song(org.mapstruct.ap.test.nestedsourceproperties.source.Song)

Example 4 with Song

use of org.mapstruct.ap.test.nestedsourceproperties.source.Song 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 5 with Song

use of org.mapstruct.ap.test.nestedsourceproperties.source.Song 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)

Aggregations

Song (org.mapstruct.ap.test.nestedsourceproperties.source.Song)21 ProcessorTest (org.mapstruct.ap.testutil.ProcessorTest)12 WithClasses (org.mapstruct.ap.testutil.WithClasses)11 ChartEntry (org.mapstruct.ap.test.nestedsourceproperties._target.ChartEntry)8 Artist (org.mapstruct.ap.test.nestedsourceproperties.source.Artist)6 Chart (org.mapstruct.ap.test.nestedsourceproperties.source.Chart)6 Label (org.mapstruct.ap.test.nestedsourceproperties.source.Label)5 Studio (org.mapstruct.ap.test.nestedsourceproperties.source.Studio)5 BaseChartEntry (org.mapstruct.ap.test.nestedsourceproperties._target.BaseChartEntry)4 ChartPositions (org.mapstruct.ap.test.nestedsourceproperties._target.ChartPositions)2 Test (org.junit.Test)1 ChartEntryComposed (org.mapstruct.ap.test.nestedsourceproperties._target.ChartEntryComposed)1 ChartEntryLabel (org.mapstruct.ap.test.nestedsourceproperties._target.ChartEntryLabel)1 ChartEntryWithBase (org.mapstruct.ap.test.nestedsourceproperties._target.ChartEntryWithBase)1 ChartEntryWithMapping (org.mapstruct.ap.test.nestedsourceproperties._target.ChartEntryWithMapping)1