-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#17 - 각 파라미터 타입별로 필드 추가 - Builder 추가
- Loading branch information
Showing
1 changed file
with
151 additions
and
0 deletions.
There are no files selected for viewing
151 changes: 151 additions & 0 deletions
151
BE/src/main/java/kr/codesquad/airbnb12/dto/TrimmedParameters.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,151 @@ | ||
package kr.codesquad.airbnb12.dto; | ||
|
||
import lombok.ToString; | ||
|
||
import java.time.LocalDate; | ||
|
||
public class TrimmedParameters { | ||
|
||
private LocalDate checkIn; | ||
|
||
private LocalDate checkOut; | ||
|
||
private Integer adults; | ||
|
||
private Integer children; | ||
|
||
private Integer infants; | ||
|
||
private Double minimumPrice; | ||
|
||
private Double maximumPrice; | ||
|
||
public TrimmedParameters() { } | ||
|
||
public TrimmedParameters(LocalDate checkIn, LocalDate checkOut, Integer adults, Integer children, Integer infants, Double minimumPrice, Double maximumPrice) { | ||
this.checkIn = checkIn; | ||
this.checkOut = checkOut; | ||
this.adults = adults; | ||
this.children = children; | ||
this.infants = infants; | ||
this.minimumPrice = minimumPrice; | ||
this.maximumPrice = maximumPrice; | ||
} | ||
|
||
public LocalDate getCheckIn() { | ||
return checkIn; | ||
} | ||
|
||
public void setCheckIn(LocalDate checkIn) { | ||
this.checkIn = checkIn; | ||
} | ||
|
||
public LocalDate getCheckOut() { | ||
return checkOut; | ||
} | ||
|
||
public void setCheckOut(LocalDate checkOut) { | ||
this.checkOut = checkOut; | ||
} | ||
|
||
public Integer getAdults() { | ||
return adults; | ||
} | ||
|
||
public void setAdults(Integer adults) { | ||
this.adults = adults; | ||
} | ||
|
||
public Integer getChildren() { | ||
return children; | ||
} | ||
|
||
public void setChildren(Integer children) { | ||
this.children = children; | ||
} | ||
|
||
public Integer getInfants() { | ||
return infants; | ||
} | ||
|
||
public void setInfants(Integer infants) { | ||
this.infants = infants; | ||
} | ||
|
||
public Double getMinimumPrice() { | ||
return minimumPrice; | ||
} | ||
|
||
public void setMinimumPrice(Double minimumPrice) { | ||
this.minimumPrice = minimumPrice; | ||
} | ||
|
||
public Double getMaximumPrice() { | ||
return maximumPrice; | ||
} | ||
|
||
public void setMaximumPrice(Double maximumPrice) { | ||
this.maximumPrice = maximumPrice; | ||
} | ||
|
||
public static class Builder { | ||
private LocalDate checkIn; | ||
private LocalDate checkOut; | ||
private Integer adults; | ||
private Integer children; | ||
private Integer infants; | ||
private Double minimumPrice; | ||
private Double maximumPrice; | ||
|
||
public Builder() { } | ||
|
||
public Builder(TrimmedParameters trimmedParameters) { | ||
this.checkIn = trimmedParameters.checkIn; | ||
this.checkOut = trimmedParameters.checkOut; | ||
this.adults = trimmedParameters.adults; | ||
this.children = trimmedParameters.children; | ||
this.infants = trimmedParameters.infants; | ||
this.minimumPrice = trimmedParameters.minimumPrice; | ||
this.maximumPrice = trimmedParameters.maximumPrice; | ||
} | ||
|
||
public Builder checkIn(LocalDate checkIn) { | ||
this.checkIn = checkIn; | ||
return this; | ||
} | ||
|
||
public Builder checkOut(LocalDate checkOut) { | ||
this.checkOut = checkOut; | ||
return this; | ||
} | ||
|
||
public Builder adults(Integer adults) { | ||
this.adults = adults; | ||
return this; | ||
} | ||
|
||
public Builder children(Integer children) { | ||
this.children = children; | ||
return this; | ||
} | ||
|
||
public Builder infants(Integer infants) { | ||
this.infants = infants; | ||
return this; | ||
} | ||
|
||
public Builder minimumPrice(Double minimumPrice) { | ||
this.minimumPrice = minimumPrice; | ||
return this; | ||
} | ||
|
||
public Builder maximumPrice(Double maximumPrice) { | ||
this.maximumPrice = maximumPrice; | ||
return this; | ||
} | ||
|
||
public TrimmedParameters build() { | ||
return new TrimmedParameters(checkIn, checkOut, adults, children, infants, minimumPrice, maximumPrice); | ||
} | ||
} | ||
} |