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