1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.atlassian.jira.rest.client.domain;
18
19 import com.google.common.base.Objects;
20
21 import java.util.Collection;
22
23
24
25
26
27
28 public class Transition {
29 private final String name;
30 private final int id;
31 private final Collection<Field> fields;
32
33 public Transition(String name, int id, Collection<Field> fields) {
34 this.name = name;
35 this.id = id;
36 this.fields = fields;
37 }
38
39 public String getName() {
40 return name;
41 }
42
43 public int getId() {
44 return id;
45 }
46
47 public Iterable<Field> getFields() {
48 return fields;
49 }
50
51 @Override
52 public boolean equals(Object obj) {
53 if (obj instanceof Transition) {
54 Transition that = (Transition) obj;
55 return Objects.equal(this.name, that.name)
56 && Objects.equal(this.id, that.id)
57 && Objects.equal(this.fields, that.fields);
58 }
59 return false;
60 }
61
62 @Override
63 public int hashCode() {
64 return Objects.hashCode(id, name, fields);
65 }
66
67
68 @Override
69 public String toString() {
70 return Objects.toStringHelper(this).
71 add("id", id).
72 add("name", name).
73 add("fields", fields).
74 toString();
75 }
76
77
78 public static class Field {
79 private final String id;
80 private final boolean isRequired;
81 private final String type;
82
83 public Field(String id, boolean isRequired, String type) {
84 this.id = id;
85 this.isRequired = isRequired;
86 this.type = type;
87 }
88
89 public String getId() {
90 return id;
91 }
92
93 public boolean isRequired() {
94 return isRequired;
95 }
96
97 public String getType() {
98 return type;
99 }
100
101 @Override
102 public int hashCode() {
103 return Objects.hashCode(id, isRequired, type);
104 }
105
106 @Override
107 public boolean equals(Object obj) {
108 if (obj instanceof Field) {
109 Field that = (Field) obj;
110 return Objects.equal(this.id, that.id)
111 && Objects.equal(this.isRequired, that.isRequired)
112 && Objects.equal(this.type, that.type);
113 }
114 return false;
115 }
116
117 @Override
118 public String toString() {
119 return Objects.toStringHelper(this).
120 add("id", id).
121 add("isRequired", isRequired).
122 add("type", type).
123 toString();
124 }
125
126 }
127 }