Mercurial > hg > Database > Christie
diff src/main/java/christie/codegear/CodeGear.java @ 23:695705dba324
Increased commands by type
author | Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 25 Jan 2018 17:46:55 +0900 |
parents | 77583ea56656 |
children | 76fac42a840e |
line wrap: on
line diff
--- a/src/main/java/christie/codegear/CodeGear.java Tue Jan 23 22:02:54 2018 +0900 +++ b/src/main/java/christie/codegear/CodeGear.java Thu Jan 25 17:46:55 2018 +0900 @@ -3,10 +3,9 @@ import christie.annotation.Peek; import christie.annotation.RemoteTake; import christie.annotation.Take; -import christie.datagear.Command; -import christie.datagear.CommandType; -import christie.datagear.DataGear; -import christie.datagear.DataGearManager; +import christie.datagear.*; +import christie.datagear.Command.Command; +import christie.datagear.Command.TakeCommand; import java.lang.reflect.Field; import java.util.ArrayList; @@ -34,20 +33,21 @@ for (Field field : this.getClass().getDeclaredFields()) {//AnnotationからInputDataGearをセット if (field.isAnnotationPresent(Take.class)) { Take ano = field.getAnnotation(Take.class); - checkAndSetCommand(field, "local", ano.value()); + createCommand(field, "local", ano.value()); } else if (field.isAnnotationPresent(Peek.class)) { Peek ano = field.getAnnotation(Peek.class); - checkAndSetCommand(field, "local", ano.value()); + createCommand(field, "local", ano.value()); } else if (field.isAnnotationPresent(RemoteTake.class)) { RemoteTake ano = field.getAnnotation(RemoteTake.class); - checkAndSetCommand(field, ano.dsmName(), ano.key()); + createCommand(field, ano.dsmName(), ano.key()); } + //ToDo:add peek } idg.finishInput(cgm, commandList); } - public void checkAndSetCommand(Field field, String dsmName, String key){ + public void createCommand(Field field, String toDsmName, String key){ if (!field.getName().equals(key)){ throw new IllegalArgumentException("key and DataGearName do not match"); @@ -64,7 +64,7 @@ throw new NullPointerException("please initialize DataGear"); } - commandList.add(new Command(CommandType.TAKE, this, cgm.cgmID, dsmName, key, dg, dg.getClazz(), null)); + commandList.add(new TakeCommand(this, cgm.cgmID, toDsmName, key, dg)); } public DataGearManager getLocalDGM() {