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