Skip to content

Commit bef0068

Browse files
Create Color.java
1 parent a14f3e7 commit bef0068

File tree

1 file changed

+49
-0
lines changed
  • data-platform/autonomous-database/autonomous-json/SpringBootDemo/src/main/java/com/oracle

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
package com.oracle;
3+
4+
import org.springframework.data.annotation.Id;
5+
import org.springframework.data.mongodb.core.mapping.Document;
6+
import org.springframework.data.mongodb.core.mapping.Field;
7+
8+
@Document(collection = "colors")
9+
public class Color {
10+
@Id
11+
private String objectId;
12+
13+
@Field(name = "name")
14+
private String name;
15+
16+
public Color() {}
17+
18+
public Color(String id, String name) {
19+
this.objectId = id;
20+
this.name = name;
21+
}
22+
23+
public void setObjectId(String id) {
24+
this.objectId = id;
25+
}
26+
27+
public String getObjectId() {
28+
return this.objectId;
29+
}
30+
31+
public void setName(String name) {
32+
this.name = name;
33+
}
34+
35+
public String getName() {
36+
return name;
37+
}
38+
39+
public String toString() {
40+
return this.objectId+" : "+this.name;
41+
}
42+
43+
@Override
44+
public final boolean equals(Object o) {
45+
if (!(o instanceof Color color)) return false;
46+
47+
return getObjectId().equals(color.getObjectId());
48+
}
49+
}

0 commit comments

Comments
 (0)