Skip to content

Commit

Permalink
#78 [feat] Mapper의 엔티티에서 도메인 객체로의 변환 시 null 값에 대한 예외 처리를 해준다.
Browse files Browse the repository at this point in the history
  • Loading branch information
juuuunny committed Nov 26, 2024
1 parent 32d043c commit a418d2f
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
public class ProfileMapper {

public static Profile toDomain(ProfileEntity profileEntity) {

if (profileEntity == null) {
return null;
}

return Profile.toDomain(
profileEntity.getId(),
profileEntity.getImgUrl(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ public class ResultMapper {

public static Result toDomain(ResultEntity resultEntity) {

if (resultEntity == null) {
return null;
}

Profile profile = ProfileMapper.toDomain(resultEntity.getProfileEntity());
List<Zone> zones = resultEntity.getZoneEntities().stream()
.map(ZoneMapper::toDomain)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
public class ZoneMapper {

public static Zone toDomain(ZoneEntity zoneEntity) {

if (zoneEntity == null) {
return null;
}

return Zone.toDomain(
zoneEntity.getId(),
zoneEntity.getName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
public class EntertainmentMapper {

public static Entertainment toDomain(EntertainmentEntity entertainmentEntity) {

if (entertainmentEntity == null) {
return null;
}

return Entertainment.toDomain(
entertainmentEntity.getId(),
entertainmentEntity.getImgUrl(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
public class FoodMapper {

public static Food toDomain(FoodEntity foodEntity) {

if (foodEntity == null) {
return null;
}

return Food.toDomain(
foodEntity.getId(),
foodEntity.getImgUrl(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ public class StadiumMapper {

public static Stadium toDomain(StadiumEntity stadiumEntity) {

if (stadiumEntity == null) {
return null;
}

List<Food> foods = stadiumEntity.getFoodEntities().stream()
.map(FoodMapper::toDomain)
.toList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
public class UserMapper {

public static User toDomain(UserEntity userEntity) {

if (userEntity == null) {
return null;
}

return User.toDomain(
userEntity.getId(),
userEntity.getProvider(),
Expand Down

0 comments on commit a418d2f

Please sign in to comment.