-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Accommodation의 연관 엔티티 매핑 Address, Location
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/main/java/com/example/airbnb/business/domain/accommodation/Address.java
This file contains 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,31 @@ | ||
package com.example.airbnb.business.domain.accommodation; | ||
|
||
import lombok.Getter; | ||
|
||
import javax.persistence.Embeddable; | ||
import javax.persistence.Transient; | ||
|
||
@Getter | ||
@Embeddable | ||
public class Address { | ||
|
||
@Transient | ||
private static final String ADDRESS_DELIMETER = " "; | ||
private String gu; | ||
private String street; | ||
private String zipCode; | ||
private String homeAddress; | ||
|
||
public Address(String gu, String street, String zipCode) { | ||
this.gu = gu; | ||
this.street = street; | ||
this.zipCode = zipCode; | ||
this.homeAddress = createHomeAddress(gu, street); | ||
} | ||
|
||
protected Address() {} | ||
|
||
private String createHomeAddress(String gu, String street) { | ||
return gu + ADDRESS_DELIMETER + street; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/com/example/airbnb/business/domain/accommodation/Location.java
This file contains 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,21 @@ | ||
package com.example.airbnb.business.domain.accommodation; | ||
|
||
import lombok.Getter; | ||
|
||
import javax.persistence.Embeddable; | ||
|
||
@Getter | ||
@Embeddable | ||
public class Location { | ||
|
||
private double longtitude; | ||
private double latitude; | ||
|
||
public Location(double longtitude, double latitude) { | ||
this.longtitude = longtitude; | ||
this.latitude = latitude; | ||
} | ||
|
||
protected Location (){} | ||
} | ||
|