Mercurial > hg > Database > Alice
view 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 |
line wrap: on
line source
package alice.Annotation; import alice.codesegment.CreateCodeSegment; import alice.codesegment.InputDataSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; import java.lang.annotation.Annotation; import java.lang.reflect.Field; import java.lang.reflect.Array; import java.lang.reflect.Method; /** * Created by e125769 on 11/14/17. */ public class AliceAnnotationTest { public static void main(String[] args){ //CreateCodeSegment createCodeSegment = new CreateCodeSegment(AliceAnnotation.class); //createCodeSegment.run(); AliceAnnotation alice = new AliceAnnotation(); //alice.ods.put("hoge", "hogehogehgoe"); //alice.ods.put("huga", "hugahugahuga"); } public void test(AliceAnnotation alice){ Class<AliceAnnotation> aliceAnnotationClass = AliceAnnotation.class; for (Field field : aliceAnnotationClass.getDeclaredFields()) { if (field.isAnnotationPresent(Take.class)){ System.out.println(field.getName()); System.out.println(field.getType()); Take i = field.getAnnotation(Take.class); System.out.println(i.value()); Receiver receiver = alice.ids.create(CommandType.TAKE); receiver.setKey(i.value()); } } } }