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.
95 lines
3.1 KiB
95 lines
3.1 KiB
package com.fr.conf.demo.simple.account; |
|
|
|
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-Config_Group") |
|
@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", status = Status.SHOW) |
|
private Conf<String> text = Holders.simple(StringUtils.EMPTY); |
|
|
|
@Identifier(value = "count", name = "Plugin-Config_Property_Count", description = "Plugin-Config_Property_Count_Description", status = Status.SHOW) |
|
private Conf<Integer> count = Holders.simple(100); |
|
|
|
@Identifier(value = "price", name = "Plugin-Config_Property_Price", description = "Plugin-Config_Property_Price_Description", status = Status.SHOW) |
|
private Conf<Double> price = Holders.simple(1000.0); |
|
|
|
@Identifier(value = "time", name = "Plugin-Config_Property_Time", description = "Plugin-Config_Property_Time_Description", status = Status.SHOW) |
|
private Conf<Long> time = Holders.simple(99999999L); |
|
|
|
@Identifier(value = "student", name = "Plugin-Config_Property_Student", description = "Plugin-Config_Property_Student_Description", status = Status.SHOW) |
|
private Conf<Boolean> student = Holders.simple(true); |
|
|
|
|
|
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); |
|
} |
|
|
|
public double getPrice() { |
|
return price.get(); |
|
} |
|
|
|
public void setPrice(double price) { |
|
this.price.set(price); |
|
} |
|
|
|
public long getTime() { |
|
return time.get(); |
|
} |
|
|
|
public void setTime(long time) { |
|
this.time.set(time); |
|
} |
|
|
|
public boolean isStudent() { |
|
return student.get(); |
|
} |
|
|
|
public void setStudent(boolean student) { |
|
this.student.set(student); |
|
} |
|
|
|
@Override |
|
public Object clone() throws CloneNotSupportedException { |
|
PluginSimpleConfig cloned = (PluginSimpleConfig) super.clone(); |
|
cloned.text = (Conf<String>) text.clone(); |
|
cloned.count = (Conf<Integer>) count.clone(); |
|
cloned.price = (Conf<Double>) price.clone(); |
|
cloned.time = (Conf<Long>) time.clone(); |
|
cloned.student = (Conf<Boolean>) student.clone(); |
|
return cloned; |
|
} |
|
}
|
|
|