本文整理匯總了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();
}