summaryrefslogtreecommitdiff
path: root/src/main/java/net/cshift/transit/network/packet/DynamicPacket.java
blob: beeea97db50af0e8dd7e2f3d66637a08b43c2a79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package net.cshift.transit.network.packet;

import net.cshift.transit.type.Type;

/**
 * Simple packet which stores a value which can change.
 *
 * @param <D> The type parameter of the Type being transported
 * @author Kyle Gunger
 * 
 */
public class DynamicPacket<D> implements IDynamicPacket<D> {
    private Object data;
    private Type<D> type;

    /** Constructor. Stores the given data and uses the given type.
     *
     * @param dat The packet's data
     * @param t The packet's type
     */
    public DynamicPacket(Object dat, Type<D> t)
    {
        data = dat;
        type = t;
    }

    @Override
    public Object getData()
    {
        return data;
    }

    @Override
    public void setData(Object dat)
    {
        data = dat;
    }

	@Override
	public Type<D> getType() {
		return type;
	}
}