Browse Source

KERNEL-1198 按要求修改

pull/1/head
Mars.Ma 5 years ago
parent
commit
056141604d
  1. 9
      src/main/java/com/fanruan/api/cal/ParameterKit.java
  2. 51
      src/main/java/com/fanruan/api/conf/ConfigurationKit.java

9
src/main/java/com/fanruan/api/cal/ParameterKit.java

@ -135,13 +135,4 @@ public class ParameterKit {
return parameters; return parameters;
} }
/**
* 将ParameterProvider转化为Parameter
* @param providers 需要转换的ParameterProvider
* @return 转换后的Parameter
*/
public static Parameter[] providers2Parameter(ParameterProvider[] providers) {
return Parameter.providers2Parameter(providers);
}
} }

51
src/main/java/com/fanruan/api/conf/ConfigurationKit.java

@ -1,51 +0,0 @@
package com.fanruan.api.conf;
import com.fr.config.ConfigContext;
import com.fr.config.Configuration;
import com.fr.config.holder.ConfigChangeListener;
import com.fr.transaction.Configurations;
import com.fr.transaction.ValidateProxy;
import com.fr.transaction.WorkerFacade;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-08-30
* 配置监听管理器
*/
public class ConfigurationKit {
/**
* 注册监听配置变化的监听器
*
* @param listener 监听器
*/
public static void registerListener(ConfigChangeListener listener) {
ValidateProxy.getInstance().getValidateManager().registerListener(listener);
}
/**
* 保存配置
*
* @param type 配置的类型
* @param action 保存动作
*/
public static void modify(Class<? extends Configuration> type, Runner action) {
Configurations.modify(new WorkerFacade(type) {
@Override
public void run() {
action.run();
}
});
}
/**
* 返回config实例且config实例只存在一个
* @param configuration Configuration类
* @param <T>
* @return config实例
*/
public static <T extends Configuration> T getConfigInstance(final Class<T> configuration) {
return ConfigContext.getConfigInstance(configuration);
}
}
Loading…
Cancel
Save