1 package uk.ac.ebi.intenz.domain.enzyme;
2
3
4
5
6
7 public class DataComment {
8
9
10 private Long id;
11
12 private String comment = "";
13
14
15 public DataComment(Long id, String comment){
16 this.id = id;
17 this.comment = comment;
18 }
19
20 public DataComment(String comment){
21 this.comment = comment;
22 }
23
24
25
26
27
28
29 private DataComment(String id, String comment){
30 try {
31 this.id = new Long(id);
32 } catch (NumberFormatException e){}
33 this.comment = comment;
34 }
35
36
37 public static DataComment valueOf(String id, String comment){
38 boolean noId = (id == null || id.trim().equals(""));
39 boolean noComment = (comment == null || comment.trim().equals(""));
40 if ( noId && noComment) return null;
41 return new DataComment(id, comment);
42 }
43
44 public boolean equals(Object o) {
45 if (this == o) return true;
46 if (!(o instanceof DataComment)) return false;
47
48 final DataComment dataComment = (DataComment) o;
49
50 if (comment != null ? !comment.equals(dataComment.comment) : dataComment.comment != null) return false;
51 if (id != null ? !id.equals(dataComment.id) : dataComment.id != null) return false;
52
53 return true;
54 }
55
56 public int hashCode() {
57 int result;
58 result = (comment != null ? comment.hashCode() : 0);
59 result = 29 * result + (id != null ? id.hashCode() : 0);
60 return result;
61 }
62
63 public String getComment(){
64 return comment;
65 }
66
67
68 public Long getId(){
69 return id;
70 }
71
72
73 public void setId(long l){
74 this.id = new Long(l);
75 }
76
77 }