本文整理汇总了Java中org.apache.commons.configuration.PropertiesConfiguration.addProperty方法的典型用法代码示例。如果您正苦于以下问题:Java PropertiesConfiguration.addProperty方法的具体用法?Java PropertiesConfiguration.addProperty怎么用?Java PropertiesConfiguration.addProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.configuration.PropertiesConfiguration
的用法示例。
在下文中一共展示了PropertiesConfiguration.addProperty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveRecord
import org.apache.commons.configuration.PropertiesConfiguration; //导入方法依赖的package包/类
public void saveRecord() throws Exception {
if (file.exists()) {
// file.renameTo(new File(Configs.recordFileName+".bak"));
file.delete();
}
file.createNewFile();
PropertiesConfiguration record = new PropertiesConfiguration(
Configs.recordFileName);
record.addProperty("verifiedUsers", Records.verifiedUsers.toArray());
// record.addProperty("records", Records.records);
Object[] usrEntries = Records.records.keySet().toArray();
record.addProperty("usrEntries", usrEntries);
for (Object usr : usrEntries) {
record.addProperty((String) usr, Records.records.get(usr).toArray());
}
record.save();
}
示例2: loadProperties
import org.apache.commons.configuration.PropertiesConfiguration; //导入方法依赖的package包/类
/**
* Creates a properties config with all the properties set
*
* @return
*/
private PropertiesConfiguration loadProperties() {
PropertiesConfiguration properties = new PropertiesConfiguration();
properties.addProperty(AdapterConfig.ADAPTER_CLASS, "adapterClass");
properties.addProperty(AdapterConfig.ADAPTER_DIR, "adapterDir");
properties.addProperty(AdapterConfig.AUTH_ENDPOINT, "authEndpoint");
properties.addProperty(AdapterConfig.COLLECT_THREADS, "1");
properties.addProperty(AdapterConfig.PROVIDER_ID, "providerId");
properties.addProperty(AdapterConfig.PROVIDER_NAME, "providerName");
properties.addProperty(AdapterConfig.PROVIDER_TYPE, "providerType");
properties.addProperty(AdapterConfig.SCHEDULING_INTERVAL, "2");
properties.addProperty(AdapterConfig.FILE_PATH, "filePath");
return properties;
}
示例3: createDefault
import org.apache.commons.configuration.PropertiesConfiguration; //导入方法依赖的package包/类
public void createDefault() throws Exception {
if (file.exists()) {
// file.renameTo(new File(Configs.recordFileName+".bak"));
file.delete();
}
file.createNewFile();
PropertiesConfiguration record = new PropertiesConfiguration(
Configs.recordFileName);
Records.mutedUsers.add("foo_-_");
Records.records.put("foo_-_", new HashSet<String>() {
{
this.add("test");
}
});
Records.verifiedUsers.add("d0048");
record.addProperty("verifiedUsers", Records.verifiedUsers.toArray());
// record.addProperty("records", Records.records);
Object[] usrEntries = Records.records.keySet().toArray();
record.addProperty("usrEntries", usrEntries);
for (Object usr : usrEntries) {
record.addProperty((String) usr, Records.records.get(usr).toArray());
}
record.save();
}