forked from fanruan/demo-simple-config
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.9 KiB
59 lines
1.9 KiB
7 years ago
|
package com.fr.conf.demo.simple;
|
||
|
|
||
|
import com.fr.config.ConfigContext;
|
||
|
import com.fr.config.DefaultConfiguration;
|
||
|
import com.fr.config.Identifier;
|
||
|
import com.fr.config.Status;
|
||
|
import com.fr.config.Visualization;
|
||
|
import com.fr.config.holder.Conf;
|
||
|
import com.fr.config.holder.factory.Holders;
|
||
|
import com.fr.intelli.record.Focus;
|
||
|
import com.fr.intelli.record.Original;
|
||
|
import com.fr.record.analyzer.EnableMetrics;
|
||
|
import com.fr.stable.StringUtils;
|
||
|
|
||
|
@Visualization(category = "Plugin")
|
||
|
@EnableMetrics
|
||
|
public class PluginSimpleConfig extends DefaultConfiguration {
|
||
|
|
||
|
private static volatile PluginSimpleConfig config = null;
|
||
|
|
||
|
@Focus(id="com.fr.conf.demo.simple", text = "Plugin-Config_Demo", source = Original.PLUGIN)
|
||
|
public static PluginSimpleConfig getInstance() {
|
||
|
if (config == null) {
|
||
|
config = ConfigContext.getConfigInstance(PluginSimpleConfig.class);
|
||
|
}
|
||
|
return config;
|
||
|
}
|
||
|
|
||
|
@Identifier(value = "text", name = "Plugin-Config_Property_Text", description = "Plugin-Config_Property_Text_Description", group = "Plugin", status = Status.SHOW)
|
||
|
private Conf<String> text = Holders.simple(StringUtils.EMPTY);
|
||
|
|
||
|
@Identifier(value = "count", name = "Plugin-Config_Property_Count", description = "Config_Property_Count_Description", group = "Plugin", status = Status.SHOW)
|
||
|
private Conf<Integer> count = Holders.simple(100);
|
||
|
|
||
|
public String getText() {
|
||
|
return text.get();
|
||
|
}
|
||
|
|
||
|
public void setText(String text) {
|
||
|
this.text.set(text);
|
||
|
}
|
||
|
|
||
|
public int getCount() {
|
||
|
return count.get();
|
||
|
}
|
||
|
|
||
|
public void setCount(int count) {
|
||
|
this.count.set(count);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public Object clone() throws CloneNotSupportedException {
|
||
|
PluginSimpleConfig cloned = (PluginSimpleConfig) super.clone();
|
||
|
cloned.text = (Conf<String>) text.clone();
|
||
|
cloned.count = (Conf<Integer>) count.clone();
|
||
|
return cloned;
|
||
|
}
|
||
|
}
|