Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package rc;
- import org.springframework.data.annotation.Id;
- import org.springframework.data.mongodb.core.index.IndexDirection;
- import org.springframework.data.mongodb.core.index.Indexed;
- import org.springframework.data.mongodb.core.mapping.Document;
- import java.util.ArrayList;
- import java.util.List;
- @Document(collection = "Hotels")
- public class Hotel {
- @Id
- private String id;
- private String name;
- @Indexed(direction = IndexDirection.ASCENDING)
- private int pricePerNight;
- private Address address;
- private List<Review> reviews;
- protected Hotel() {
- this.reviews = new ArrayList<>();
- }
- public Hotel(String name, int pricePerNight, Address address, List<Review> reviews) {
- this.name = name;
- this.pricePerNight = pricePerNight;
- this.address = address;
- this.reviews = reviews;
- }
- public String getId() {
- return id;
- }
- public String getName() {
- return name;
- }
- public int getPricePerNight() {
- return pricePerNight;
- }
- public Address getAddress() {
- return address;
- }
- public List<Review> getReviews() {
- return reviews;
- }
- }
Add Comment
Please, Sign In to add comment