1, 添加void setOperations(String options)

2,修改Operation的option属性的类型为Map<String, String>
hechu
zhai_lw 6 years ago
parent efd5f851b4
commit e21fc49ae3

@ -4,7 +4,11 @@ package core.operation;
import java.util.Map; import java.util.Map;
public interface Executable { public interface Executable {
default void execute(Map<String, Object> options) throws Exception { default void execute(String options){
}
default void execute(Map<String, String> options) throws Exception {
checkSelf(); checkSelf();
beforeRun(options); beforeRun(options);
run(options); run(options);
@ -13,9 +17,11 @@ public interface Executable {
void checkSelf ()throws Exception; void checkSelf ()throws Exception;
void beforeRun(Map<String, Object> options); void beforeRun(Map<String, String> options);
void run(Map<String, String> options);
void run(Map<String, Object> options);
void afterRun(Map<String, Object> options); void afterRun(Map<String, String> options);
} }

@ -24,11 +24,11 @@ public abstract class Operation implements Executable {
if(subject==null) throw new Exception("Operation's subject is Null"); if(subject==null) throw new Exception("Operation's subject is Null");
} }
@Override @Override
public void beforeRun(Map<String, Object> options) { public void beforeRun(Map<String, String> options) {
core.operation.utils.util.checkOptions(core.utils.ConfigurationFileManagement.getConfigurationFile(this.getClass().getName()),options); core.operation.utils.util.checkOptions(core.utils.ConfigurationFileManagement.getConfigurationFile(this.getClass().getName()),options);
} }
@Override @Override
public void afterRun(Map<String, Object> options) { public void afterRun(Map<String, String> options) {
//todo //todo
} }
} }

@ -6,7 +6,7 @@ import java.util.Map;
public class UploadFileOperation extends Operation { public class UploadFileOperation extends Operation {
Map<String, Object> options; Map<String, Object> options;
@Override @Override
public void run(Map<String, Object> options) { public void run(Map<String, String> options) {
//todo //todo
} }

@ -4,7 +4,7 @@ import java.io.File;
import java.util.Map; import java.util.Map;
public interface util { public interface util {
static void checkOptions(File jsonFile, Map<String, Object> options){ static void checkOptions(File jsonFile, Map<String, String> options){
} }
} }

Loading…
Cancel
Save