Mercurial > hg > Database > Christie
view src/main/java/christie/codegear/CodeGear.java @ 1:3ea61d0bfc34
add dependency proccess but not work
author | Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 11 Dec 2017 21:19:25 +0900 |
parents | c082039368f5 |
children | bacdcb5e6dcf |
line wrap: on
line source
package christie.codegear; import christie.annotation.Take; import christie.datagear.DataGear; import christie.datagear.DataGearManager; import christie.datagear.StringData; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.HashMap; /** * Created by e125769 on 12/7/17. * Annotationからのinputコマンドの生成、揃ったDataGearの値を返す */ public interface CodeGear extends Runnable{ InputDataGear idg = new InputDataGear(); OutputDataGear odg = new OutputDataGear(); //CodeGearManager cgm = null; ArrayList<Command> commandList = new ArrayList<Command>(); default void setKey(CodeGearManager cgm){//AnnotationからInputDataGearをセット for (Field field : this.getClass().getDeclaredFields()) { if (field.isAnnotationPresent(Take.class)){//何故かここに入らない Take ano = field.getAnnotation(Take.class); System.out.println(ano.value()); commandList.add(new Command(this, null, "local", ano.value(), CommandType.TAKE)); } } idg.finishInput(cgm, this, commandList); } default void setValue(){//Annotationから揃ったInputDataGearの値をキャスト for (Field field : this.getClass().getDeclaredFields()) { field.setAccessible(true); if (field.isAnnotationPresent(Take.class)){ Take ano = field.getAnnotation(Take.class); try { field.set(this, idg.inputs.get(ano.value()));//ダウンキャストできるか? } catch (IllegalAccessException e) { e.printStackTrace(); } } } } default void put(String key, Object data){ //cgm.getDGM("local").put(key, new DataGear(data)); } default void put(String dist, String key, Object data){ //cgm.getDGM(dist).put(key, new DataGear(data)); } }