1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.chemistry.opencmis.client.runtime;
20
21 import java.io.Serializable;
22
23 import org.apache.chemistry.opencmis.client.api.ObjectId;
24
25
26
27
28 public class ObjectIdImpl implements ObjectId, Serializable {
29
30 private static final long serialVersionUID = 1L;
31
32 private String id;
33
34
35
36
37 public ObjectIdImpl(String id) {
38 if (id == null || id.length() == 0) {
39 throw new IllegalArgumentException("Id must be set!");
40 }
41
42 this.id = id;
43 }
44
45 @Override
46 public String getId() {
47 return id;
48 }
49
50
51
52
53 public void setId(String id) {
54 if (id == null || id.length() == 0) {
55 throw new IllegalArgumentException("Id must be set!");
56 }
57
58 this.id = id;
59 }
60
61 @Override
62 public String toString() {
63 return "Object Id: " + id;
64 }
65
66 @Override
67 public int hashCode() {
68 return id.hashCode();
69 }
70
71 @Override
72 public boolean equals(Object obj) {
73 if (this == obj) {
74 return true;
75 }
76
77 if (obj == null || getClass() != obj.getClass()) {
78 return false;
79 }
80
81 return id.equals(((ObjectIdImpl) obj).id);
82 }
83 }