blob: 7102f93a0a117d4a285e8c7985bc39578f519f05 [file] [log] [blame]
Andrew Brown3f2521a2015-01-17 22:10:15 -08001/*
2 * File name: ClientObservableEvent.java
3 *
4 * Purpose:
5 *
6 * © Copyright Intel Corporation. All rights reserved.
7 * Intel Corporation, 2200 Mission College Boulevard,
8 * Santa Clara, CA 95052-8119, USA
9 */
10package com.intel.jndn.utils;
11
12/**
13 *
14 * @author Andrew Brown <andrew.brown@intel.com>
15 */
16public class ClientObservableEvent<T> {
17
18 boolean success;
19 long timestamp;
20 T packet;
21
22 public ClientObservableEvent(T packet) {
23 fromPacket(packet);
24 }
25
26 public ClientObservableEvent() {
27 timestamp = System.currentTimeMillis();
28 success = false;
29 }
30
31 public final void fromPacket(T packet_){
32 timestamp = System.currentTimeMillis();
33 success = !Exception.class.isInstance(packet_);
34 packet = packet_;
35 }
36
37 public boolean isSuccess() {
38 return success;
39 }
40
41 public void setSuccess(boolean success) {
42 this.success = success;
43 }
44
45 public long getTimestamp() {
46 return timestamp;
47 }
48
49 public void setTimestamp(long timestamp) {
50 this.timestamp = timestamp;
51 }
52
53 public T getPacket() {
54 return packet;
55 }
56
57 public void setPacket(T packet) {
58 this.packet = packet;
59 }
60
61}