1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty.handler.codec.http2;
17
18
19
20
21 public final class DefaultHttp2PriorityFrame extends AbstractHttp2StreamFrame implements Http2PriorityFrame {
22
23 private final int streamDependency;
24 private final short weight;
25 private final boolean exclusive;
26
27 public DefaultHttp2PriorityFrame(int streamDependency, short weight, boolean exclusive) {
28 this.streamDependency = streamDependency;
29 this.weight = weight;
30 this.exclusive = exclusive;
31 }
32
33 @Override
34 public int streamDependency() {
35 return streamDependency;
36 }
37
38 @Override
39 public short weight() {
40 return weight;
41 }
42
43 @Override
44 public boolean exclusive() {
45 return exclusive;
46 }
47
48 @Override
49 public DefaultHttp2PriorityFrame stream(Http2FrameStream stream) {
50 super.stream(stream);
51 return this;
52 }
53
54 @Override
55 public String name() {
56 return "PRIORITY_FRAME";
57 }
58
59 @Override
60 public boolean equals(Object o) {
61 if (!(o instanceof DefaultHttp2PriorityFrame)) {
62 return false;
63 }
64 DefaultHttp2PriorityFrame other = (DefaultHttp2PriorityFrame) o;
65 boolean same = super.equals(other);
66 return same && streamDependency == other.streamDependency
67 && weight == other.weight && exclusive == other.exclusive;
68 }
69
70 @Override
71 public int hashCode() {
72 int hash = super.hashCode();
73 hash = hash * 31 + streamDependency;
74 hash = hash * 31 + weight;
75 hash = hash * 31 + (exclusive ? 1 : 0);
76 return hash;
77 }
78
79 @Override
80 public String toString() {
81 return "DefaultHttp2PriorityFrame(" +
82 "stream=" + stream() +
83 ", streamDependency=" + streamDependency +
84 ", weight=" + weight +
85 ", exclusive=" + exclusive +
86 ')';
87 }
88 }