Skip to content

Commit 0541065

Browse files
committed
Added a new Amenity model
1 parent 49f7312 commit 0541065

2 files changed

Lines changed: 116 additions & 0 deletions

File tree

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
package com.robinpowered.sdk.model;
2+
3+
import com.google.common.base.Objects;
4+
import org.joda.time.DateTime;
5+
6+
/**
7+
* An amenity that may be associated to a {@link Space}.
8+
*
9+
* <p>
10+
* Amenities may be created or removed within an organization, though a default set of amenities is always present.
11+
* Each amenity may then be associated or disassociated from any spaces within that organization.
12+
*/
13+
public class Amenity implements ApiResponseModel {
14+
15+
/**
16+
* Constants
17+
*/
18+
19+
public static final String MIME_TYPE = "vnd.robinpowered.amenity.v1";
20+
21+
22+
/**
23+
* Properties
24+
*/
25+
26+
// Immutable
27+
private final Integer id;
28+
private final Integer accountId;
29+
private final DateTime createdAt;
30+
private final DateTime updatedAt;
31+
32+
// Mutable
33+
private String name;
34+
35+
36+
/**
37+
* Methods
38+
*/
39+
40+
public Amenity(Integer id, Integer accountId, DateTime createdAt, DateTime updatedAt) {
41+
this.id = id;
42+
this.accountId = accountId;
43+
this.createdAt = createdAt;
44+
this.updatedAt = updatedAt;
45+
}
46+
47+
public Integer getId() {
48+
return id;
49+
}
50+
51+
public Integer getAccountId() {
52+
return accountId;
53+
}
54+
55+
public DateTime getCreatedAt() {
56+
return createdAt;
57+
}
58+
59+
public DateTime getUpdatedAt() {
60+
return updatedAt;
61+
}
62+
63+
public String getName() {
64+
return name;
65+
}
66+
67+
public void setName(String name) {
68+
this.name = name;
69+
}
70+
71+
@Override
72+
public boolean equals(Object o) {
73+
if (this == o) return true;
74+
if (o == null || getClass() != o.getClass()) return false;
75+
Amenity amenity = (Amenity) o;
76+
return Objects.equal(id, amenity.id) &&
77+
Objects.equal(accountId, amenity.accountId) &&
78+
Objects.equal(createdAt, amenity.createdAt) &&
79+
Objects.equal(updatedAt, amenity.updatedAt);
80+
}
81+
82+
@Override
83+
public int hashCode() {
84+
return Objects.hashCode(id, accountId, createdAt, updatedAt);
85+
}
86+
87+
@Override
88+
public String toString() {
89+
return "Amenity{" +
90+
"id=" + id +
91+
", accountId=" + accountId +
92+
", createdAt=" + createdAt +
93+
", updatedAt=" + updatedAt +
94+
", name='" + name + '\'' +
95+
'}';
96+
}
97+
98+
@Override
99+
public String getMimeType() {
100+
return MIME_TYPE;
101+
}
102+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.robinpowered.sdk.model;
2+
3+
import nl.jqno.equalsverifier.EqualsVerifier;
4+
import org.junit.Test;
5+
6+
public class AmenityTest {
7+
8+
@Test
9+
public void testEqualsAndHashcode() {
10+
EqualsVerifier.forClass(Amenity.class)
11+
.usingGetClass()
12+
.verify();
13+
}
14+
}

0 commit comments

Comments
 (0)