Mercurial > hg > Members > tatsuki > Alice
comparison src/main/java/alice/datasegment/ReceiveLocalData.java @ 345:8f71c3e6f11d
Change directory structure Maven standard
author | sugi |
---|---|
date | Wed, 16 Apr 2014 18:26:07 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
344:9f97ec18f8c5 | 345:8f71c3e6f11d |
---|---|
1 package alice.datasegment; | |
2 | |
3 import java.io.IOException; | |
4 | |
5 import org.msgpack.type.ArrayValue; | |
6 import org.msgpack.type.Value; | |
7 | |
8 import alice.codesegment.SingletonMessage; | |
9 import alice.datasegment.ReceiverData; | |
10 | |
11 public class ReceiveLocalData implements ReceiverData { | |
12 private Object obj; | |
13 | |
14 public ReceiveLocalData(Object obj2) { | |
15 this.obj = obj2; | |
16 } | |
17 | |
18 public String asString() { | |
19 return (String) obj; | |
20 } | |
21 | |
22 public int asInteger() { | |
23 return (Integer) obj; | |
24 } | |
25 | |
26 public Float asFloat() { | |
27 return (Float) obj; | |
28 } | |
29 | |
30 public ArrayValue asArray(){ | |
31 return (ArrayValue) obj; | |
32 } | |
33 | |
34 @SuppressWarnings("unchecked") | |
35 public <T> T asClass(Class<T> clazz) { | |
36 return (T) obj; | |
37 | |
38 } | |
39 | |
40 @Override | |
41 public Value getVal() { | |
42 try { | |
43 return SingletonMessage.getInstance().unconvert(obj); | |
44 } catch (IOException e) { | |
45 e.printStackTrace(); | |
46 } | |
47 return null; | |
48 } | |
49 | |
50 @Override | |
51 public Object getObj() { | |
52 return obj; | |
53 } | |
54 | |
55 } |