Mercurial > hg > Database > Alice
annotate src/main/java/alice/Annotation/AliceAnnotationTest.java @ 635:0423eb7fd9ee
work create Receiver from Annotation.
Please invoke setKey after create all Receiver.
author | Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 03 Dec 2017 00:09:04 +0900 |
parents | 69f9c5ff1df9 |
children | 33f300d0720a |
rev | line source |
---|---|
630 | 1 package alice.Annotation; |
2 | |
633
746447b7c3e0
add CreateCodeSegment Factory
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
630
diff
changeset
|
3 import alice.codesegment.CreateCodeSegment; |
630 | 4 import alice.codesegment.InputDataSegment; |
5 import alice.datasegment.CommandType; | |
6 import alice.datasegment.Receiver; | |
7 | |
8 import java.lang.annotation.Annotation; | |
9 import java.lang.reflect.Field; | |
10 import java.lang.reflect.Array; | |
11 import java.lang.reflect.Method; | |
12 | |
13 /** | |
14 * Created by e125769 on 11/14/17. | |
15 */ | |
16 public class AliceAnnotationTest { | |
17 public static void main(String[] args){ | |
634
69f9c5ff1df9
work reflection setKey, but not correct
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
633
diff
changeset
|
18 //CreateCodeSegment createCodeSegment = new CreateCodeSegment(AliceAnnotation.class); |
69f9c5ff1df9
work reflection setKey, but not correct
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
633
diff
changeset
|
19 //createCodeSegment.run(); |
69f9c5ff1df9
work reflection setKey, but not correct
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
633
diff
changeset
|
20 AliceAnnotation alice = new AliceAnnotation(); |
69f9c5ff1df9
work reflection setKey, but not correct
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
633
diff
changeset
|
21 //alice.ods.put("hoge", "hogehogehgoe"); |
69f9c5ff1df9
work reflection setKey, but not correct
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
633
diff
changeset
|
22 //alice.ods.put("huga", "hugahugahuga"); |
630 | 23 } |
24 | |
25 public void test(AliceAnnotation alice){ | |
26 Class<AliceAnnotation> aliceAnnotationClass = AliceAnnotation.class; | |
27 | |
634
69f9c5ff1df9
work reflection setKey, but not correct
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
633
diff
changeset
|
28 for (Field field : aliceAnnotationClass.getDeclaredFields()) { |
630 | 29 if (field.isAnnotationPresent(Take.class)){ |
30 System.out.println(field.getName()); | |
31 System.out.println(field.getType()); | |
32 Take i = field.getAnnotation(Take.class); | |
33 System.out.println(i.value()); | |
634
69f9c5ff1df9
work reflection setKey, but not correct
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
633
diff
changeset
|
34 Receiver receiver = alice.ids.create(CommandType.TAKE); |
630 | 35 receiver.setKey(i.value()); |
36 } | |
634
69f9c5ff1df9
work reflection setKey, but not correct
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
633
diff
changeset
|
37 } |
630 | 38 } |
39 } |