1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.atlassian.jira.rest.client.api.domain;
18
19 import com.google.common.base.Objects;
20 import com.google.common.base.Optional;
21
22 import javax.annotation.Nullable;
23
24
25
26
27
28
29 public class OperationLink implements Operation {
30 @Nullable
31 private final String id;
32 @Nullable
33 private final String styleClass;
34 private final String label;
35 @Nullable
36 private final String title;
37 private final String href;
38 @Nullable
39 private final Integer weight;
40 @Nullable
41 private final String iconClass;
42
43 public OperationLink(@Nullable final String id, @Nullable final String styleClass, final String label, @Nullable final String title,
44 final String href, @Nullable final Integer weight, @Nullable final String iconClass) {
45 this.id = id;
46 this.styleClass = styleClass;
47 this.iconClass = iconClass;
48 this.label = label;
49 this.title = title;
50 this.href = href;
51 this.weight = weight;
52 }
53
54 @Nullable
55 @Override
56 public String getId() {
57 return id;
58 }
59
60 @Override
61 public <T> Optional<T> accept(final OperationVisitor<T> visitor) {
62 return visitor.visit(this);
63 }
64
65 @Nullable
66 public String getStyleClass() {
67 return styleClass;
68 }
69
70 public String getLabel() {
71 return label;
72 }
73
74 @Nullable
75 public String getTitle() {
76 return title;
77 }
78
79 public String getHref() {
80 return href;
81 }
82
83 @Nullable
84 public Integer getWeight() {
85 return weight;
86 }
87
88 @Nullable
89 public String getIconClass() {
90 return iconClass;
91 }
92
93 @Override
94 public boolean equals(Object o) {
95 if (o instanceof OperationLink) {
96 OperationLink that = (OperationLink) o;
97 return Objects.equal(id, that.id)
98 && Objects.equal(styleClass, that.styleClass)
99 && Objects.equal(label, that.label)
100 && Objects.equal(title, that.title)
101 && Objects.equal(href, that.href)
102 && Objects.equal(weight, that.weight)
103 && Objects.equal(iconClass, that.iconClass);
104 }
105 return false;
106 }
107
108 @Override
109 public int hashCode() {
110 return Objects.hashCode(id, styleClass, label, title, href, weight, iconClass);
111 }
112
113 @Override
114 public String toString() {
115 return Objects.toStringHelper(this)
116 .add("id", id)
117 .add("styleClass", styleClass)
118 .add("label", label)
119 .add("title", title)
120 .add("href", href)
121 .add("weight", weight)
122 .add("iconClass", iconClass)
123 .toString();
124 }
125 }