Skip to content

Commit

Permalink
Feat: 엔티티 매핑 #22
Browse files Browse the repository at this point in the history
- Accommodation의 연관 엔티티 매핑 Address, Location
  • Loading branch information
devjun10 committed May 27, 2022
1 parent e5dd133 commit d0a3797
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
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;
}
}
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 (){}
}

0 comments on commit d0a3797

Please sign in to comment.