-
-
Notifications
You must be signed in to change notification settings - Fork 1k
#4062 added the new switch expression usage for jdk greater than 13 #4065
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
...est/resources/fixtures/21/org/mapstruct/ap/test/nestedbeans/UserDtoMapperClassicImpl.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| /* | ||
| * Copyright MapStruct Authors. | ||
| * | ||
| * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
| */ | ||
| package org.mapstruct.ap.test.nestedbeans; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
| import javax.annotation.processing.Generated; | ||
|
|
||
| @Generated( | ||
| value = "org.mapstruct.ap.MappingProcessor", | ||
| date = "2026-06-12T22:15:18+0200", | ||
| comments = "version: , compiler: javac, environment: Java 21.0.11 (Eclipse Adoptium)" | ||
| ) | ||
| public class UserDtoMapperClassicImpl implements UserDtoMapperClassic { | ||
|
|
||
| @Override | ||
| public UserDto userToUserDto(User user) { | ||
| if ( user == null ) { | ||
| return null; | ||
| } | ||
|
|
||
| UserDto userDto = new UserDto(); | ||
|
|
||
| userDto.setName( user.getName() ); | ||
| userDto.setCar( carToCarDto( user.getCar() ) ); | ||
| userDto.setSecondCar( carToCarDto( user.getSecondCar() ) ); | ||
| userDto.setHouse( houseToHouseDto( user.getHouse() ) ); | ||
|
|
||
| return userDto; | ||
| } | ||
|
|
||
| @Override | ||
| public CarDto carToCarDto(Car car) { | ||
| if ( car == null ) { | ||
| return null; | ||
| } | ||
|
|
||
| CarDto carDto = new CarDto(); | ||
|
|
||
| carDto.setName( car.getName() ); | ||
| carDto.setYear( car.getYear() ); | ||
| carDto.setWheels( mapWheels( car.getWheels() ) ); | ||
|
|
||
| return carDto; | ||
| } | ||
|
|
||
| @Override | ||
| public HouseDto houseToHouseDto(House house) { | ||
| if ( house == null ) { | ||
| return null; | ||
| } | ||
|
|
||
| HouseDto houseDto = new HouseDto(); | ||
|
|
||
| houseDto.setName( house.getName() ); | ||
| houseDto.setYear( house.getYear() ); | ||
| houseDto.setRoof( roofToRoofDto( house.getRoof() ) ); | ||
|
|
||
| return houseDto; | ||
| } | ||
|
|
||
| @Override | ||
| public RoofDto roofToRoofDto(Roof roof) { | ||
| if ( roof == null ) { | ||
| return null; | ||
| } | ||
|
|
||
| RoofDto roofDto = new RoofDto(); | ||
|
|
||
| roofDto.setColor( String.valueOf( roof.getColor() ) ); | ||
| roofDto.setType( mapRoofType( roof.getType() ) ); | ||
|
|
||
| return roofDto; | ||
| } | ||
|
|
||
| @Override | ||
| public List<WheelDto> mapWheels(List<Wheel> wheels) { | ||
| if ( wheels == null ) { | ||
| return null; | ||
| } | ||
|
|
||
| List<WheelDto> list = new ArrayList<>( wheels.size() ); | ||
| for ( Wheel wheel : wheels ) { | ||
| list.add( mapWheel( wheel ) ); | ||
| } | ||
|
|
||
| return list; | ||
| } | ||
|
|
||
| @Override | ||
| public WheelDto mapWheel(Wheel wheels) { | ||
| if ( wheels == null ) { | ||
| return null; | ||
| } | ||
|
|
||
| WheelDto wheelDto = new WheelDto(); | ||
|
|
||
| wheelDto.setFront( wheels.isFront() ); | ||
| wheelDto.setRight( wheels.isRight() ); | ||
|
|
||
| return wheelDto; | ||
| } | ||
|
|
||
| @Override | ||
| public ExternalRoofType mapRoofType(RoofType roofType) { | ||
| if ( roofType == null ) { | ||
| return null; | ||
| } | ||
|
|
||
| ExternalRoofType externalRoofType = switch ( roofType ) { | ||
| case OPEN -> ExternalRoofType.OPEN; | ||
| case BOX -> ExternalRoofType.BOX; | ||
| case GAMBREL -> ExternalRoofType.GAMBREL; | ||
| }; | ||
|
|
||
| return externalRoofType; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.