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
21
22
23
24
25
26 public class Visibility {
27 public enum Type {
28 ROLE, GROUP
29 }
30
31 private final Type type;
32 private final String value;
33
34 public Visibility(Type type, String value) {
35 this.type = type;
36 this.value = value;
37 }
38
39 public Type getType() {
40 return type;
41 }
42
43 public String getValue() {
44 return value;
45 }
46
47 public static Visibility role(String value) {
48 return new Visibility(Type.ROLE, value);
49 }
50
51 public static Visibility group(String group) {
52 return new Visibility(Type.GROUP, group);
53 }
54
55 @Override
56 public String toString() {
57 return Objects.toStringHelper(this).
58 add("type", type).
59 add("value", value).
60 toString();
61 }
62
63 @Override
64 public boolean equals(Object obj) {
65 if (obj instanceof Visibility) {
66 Visibility that = (Visibility) obj;
67 return Objects.equal(this.type, that.type) && Objects.equal(this.value, that.value);
68 }
69 return false;
70 }
71
72 @Override
73 public int hashCode() {
74 return Objects.hashCode(type, value);
75 }
76 }