1 package uk.ac.ebi.intenz.domain.enzyme;
2
3 import uk.ac.ebi.intenz.domain.constants.EnzymeSourceConstant;
4 import uk.ac.ebi.intenz.domain.constants.EnzymeViewConstant;
5
6
7
8
9
10
11
12
13
14 public class EnzymeComment implements Viewable {
15
16 private String commentText;
17
18 private EnzymeSourceConstant source;
19
20 private EnzymeViewConstant view;
21
22
23
24
25
26
27
28
29
30
31 public EnzymeComment(String commentText, EnzymeSourceConstant source, EnzymeViewConstant view) {
32 if (commentText == null) throw new NullPointerException("Parameter 'commentText' must not be null.");
33 if (source == null) throw new NullPointerException("Parameter 'source' must not be null.");
34 if (view == null) throw new NullPointerException("Parameter 'view' must not be null.");
35 if (commentText.equals("")) throw new IllegalArgumentException("Parameter 'commentText' must not be empty.");
36 this.commentText = commentText;
37 this.source = source;
38 this.view = view;
39 }
40
41
42
43
44
45
46
47 public boolean equals(Object o) {
48 if (this == o) return true;
49 if (!(o instanceof EnzymeComment)) return false;
50
51 final EnzymeComment comment = (EnzymeComment) o;
52
53 if (commentText != null ? !commentText.equals(comment.commentText) : comment.commentText != null) return false;
54 if (source != null ? !source.equals(comment.source) : comment.source != null) return false;
55 if (view != null ? !view.equals(comment.view) : comment.view != null) return false;
56
57 return true;
58 }
59
60
61
62
63
64
65 public int hashCode() {
66 int result;
67 result = (commentText != null ? commentText.hashCode() : 0);
68 result = 29 * result + (source != null ? source.hashCode() : 0);
69 result = 29 * result + (view != null ? view.hashCode() : 0);
70 return result;
71 }
72
73
74
75
76 public String getCommentText() {
77 return commentText;
78 }
79
80 public EnzymeSourceConstant getSource() {
81 return source;
82 }
83
84 public EnzymeViewConstant getView() {
85 return view;
86 }
87
88 }