Created
November 16, 2020 11:23
-
-
Save dev-aritra/a65d762012c16961a41c3ba587c3275f to your computer and use it in GitHub Desktop.
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
@Data | |
@AllArgsConstructor | |
public class StorePresenter { | |
private String id; | |
private final String name; | |
private final String zipCode; | |
private final Double latitude; | |
private final Double longitude; | |
public Store toDomain() { | |
return new Store(name, new Location(zipCode, latitude, longitude)); | |
} | |
public static StorePresenter fromDomain(Store store) { | |
return new StorePresenter( | |
store.getId(), | |
store.getName(), | |
store.getLocation().getZipCode(), | |
store.getLocation().getLatitude(), | |
store.getLocation().getLongitude()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment