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 private final String id;
31 @Nullable private final String styleClass;
32 private final String label;
33 @Nullable private final String title;
34 private final String href;
35 @Nullable private final Integer weight;
36 @Nullable private final String iconClass;
37
38 public OperationLink(@Nullable final String id, @Nullable final String styleClass, final String label, @Nullable final String title,
39 final String href, @Nullable final Integer weight, @Nullable final String iconClass) {
40 this.id = id;
41 this.styleClass = styleClass;
42 this.iconClass = iconClass;
43 this.label = label;
44 this.title = title;
45 this.href = href;
46 this.weight = weight;
47 }
48
49 @Nullable
50 @Override
51 public String getId() {
52 return id;
53 }
54
55 @Override
56 public <T> Optional<T> accept(final OperationVisitor<T> visitor) {
57 return visitor.visit(this);
58 }
59
60 @Nullable
61 public String getStyleClass() {
62 return styleClass;
63 }
64
65 public String getLabel() {
66 return label;
67 }
68
69 @Nullable
70 public String getTitle() {
71 return title;
72 }
73
74 public String getHref() {
75 return href;
76 }
77
78 @Nullable
79 public Integer getWeight() {
80 return weight;
81 }
82
83 @Nullable
84 public String getIconClass() {
85 return iconClass;
86 }
87
88 @Override
89 public boolean equals(Object o) {
90 if (o instanceof OperationLink) {
91 OperationLink that = (OperationLink) o;
92 return Objects.equal(id, that.id)
93 && Objects.equal(styleClass, that.styleClass)
94 && Objects.equal(label, that.label)
95 && Objects.equal(title, that.title)
96 && Objects.equal(href, that.href)
97 && Objects.equal(weight, that.weight)
98 && Objects.equal(iconClass, that.iconClass);
99 }
100 return false;
101 }
102
103 @Override
104 public int hashCode() {
105 return Objects.hashCode(id, styleClass, label, title, href, weight, iconClass);
106 }
107
108 @Override
109 public String toString() {
110 return Objects.toStringHelper(this)
111 .add("id", id)
112 .add("styleClass", styleClass)
113 .add("label", label)
114 .add("title", title)
115 .add("href", href)
116 .add("weight", weight)
117 .add("iconClass", iconClass)
118 .toString();
119 }
120 }