RuneHive-Game
Loading...
Searching...
No Matches
ChannelRequest.java
Go to the documentation of this file.
1package dev.advo.fs.dispatch;
2
3import org.jboss.netty.channel.Channel;
4
5/**
6 * A specialised request which contains a channel as well as the request object
7 * itself.
8 * @author Graham
9 * @param <T> The type of request.
10 */
11public final class ChannelRequest<T> implements Comparable<ChannelRequest<T>> {
12
13 /**
14 * The channel.
15 */
16 private final Channel channel;
17
18 /**
19 * The request.
20 */
21 private final T request;
22
23 /**
24 * Creates a new channel request.
25 * @param channel The channel.
26 * @param request The request.
27 */
28 public ChannelRequest(Channel channel, T request) {
29 this.channel = channel;
30 this.request = request;
31 }
32
33 /**
34 * Gets the channel.
35 * @return The channel.
36 */
37 public Channel getChannel() {
38 return channel;
39 }
40
41 /**
42 * Gets the request.
43 * @return The request.
44 */
45 public T getRequest() {
46 return request;
47 }
48
49 @SuppressWarnings("unchecked")
50 @Override
52 if (request instanceof Comparable<?> && o.request instanceof Comparable<?>) {
53 return ((Comparable<T>) request).compareTo(o.request);
54 }
55 return 0;
56 }
57
58}
Channel getChannel()
Gets the channel.
int compareTo(ChannelRequest< T > o)
ChannelRequest(Channel channel, T request)
Creates a new channel request.
final Channel channel
The channel.