本文整理汇总了Java中org.ini4j.Profile.Section方法的典型用法代码示例。如果您正苦于以下问题:Java Profile.Section方法的具体用法?Java Profile.Section怎么用?Java Profile.Section使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ini4j.Profile
的用法示例。
在下文中一共展示了Profile.Section方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addDwarf
import org.ini4j.Profile; //导入方法依赖的package包/类
public static Profile.Section addDwarf(Profile prof, DwarfData dwarf)
{
Profile.Section s = prof.add(dwarf.name);
inject(s, dwarf, "");
if (dwarf.name.equals(Dwarfs.PROP_DOPEY))
{
s.put(Dwarf.PROP_WEIGHT, DwarfsData.INI_DOPEY_WEIGHT, 0);
s.put(Dwarf.PROP_HEIGHT, DwarfsData.INI_DOPEY_HEIGHT, 0);
}
else if (dwarf.name.equals(Dwarfs.PROP_GRUMPY))
{
s.put(Dwarf.PROP_HEIGHT, DwarfsData.INI_GRUMPY_HEIGHT, 0);
}
else if (dwarf.name.equals(Dwarfs.PROP_SLEEPY))
{
s.put(Dwarf.PROP_HEIGHT, DwarfsData.INI_SLEEPY_HEIGHT, 0);
}
else if (dwarf.name.equals(Dwarfs.PROP_SNEEZY))
{
s.put(Dwarf.PROP_HOME_PAGE, DwarfsData.INI_SNEEZY_HOME_PAGE, 0);
}
return s;
}
示例2: load
import org.ini4j.Profile; //导入方法依赖的package包/类
@Override
protected void load(Profile.Section sec) throws Exception {
afkChannelId = sec.get("afk_channel_id", int.class);
channels = EasyMethods.convertArrayToList(sec.getAll("channels", int[].class));
excludeMode = sec.get("exclude_mode", boolean.class);
whitelistGroup = PermissionGroup.getPermissionGroupByName(sec.get("whitelist_group"));
afkTime = sec.get("max_afk_time", int.class) * 1000;
if (sec.get("condition_away", boolean.class))
afkConditions.add("away");
if (sec.get("condition_mic_muted", boolean.class))
afkConditions.add("mic_muted");
if (sec.get("condition_mic_disabled", boolean.class))
afkConditions.add("mic_disabled");
if (sec.get("condition_speaker_muted", boolean.class))
afkConditions.add("speaker_muted");
if (sec.get("condition_speaker_disabled", boolean.class))
afkConditions.add("speaker_disabled");
afkConditionsMinimumMet = sec.get("condition_min", int.class);
}
示例3: getDefaultIni
import org.ini4j.Profile; //导入方法依赖的package包/类
private static Ini getDefaultIni() {
Ini ini = new Ini();
Profile.Section defaultSec = ini.add("Admins");
defaultSec.add("uid", "uid1");
defaultSec.add("group", 6);
defaultSec = ini.add("Supporters");
defaultSec.add("uid", "uid2");
defaultSec.add("group", 6);
defaultSec.add("inherit", "Admins");
defaultSec = ini.add("VIPs");
defaultSec.add("uid", "uid3");
defaultSec.add("uid", "uid4");
defaultSec.add("group", 6);
defaultSec.add("inherit", "Supporters");
return ini;
}
示例4: compare
import org.ini4j.Profile; //导入方法依赖的package包/类
public Config compare() throws IOException {
if (defaultIni == null) {
throw new NullPointerException("Default Config not defined");
}
for (Profile.Section section : defaultIni.values()) {
if (!ini.containsKey(section.getName())) {
ini.put(section.getName(), section);
ini.putComment(section.getName(), defaultIni.getComment(section.getName()));
changed = true;
} else {
for (String key : section.keySet()) {
Profile.Section realSection = ini.get(section.getName());
if (!realSection.containsKey(key)) {
realSection.put(key, section.get(key));
realSection.putComment(key, section.getComment(key));
changed = true;
}
}
}
}
if (wasChanged())
ini.store();
return this;
}
示例5: getPartitions
import org.ini4j.Profile; //导入方法依赖的package包/类
public List<Partition> getPartitions() {
ArrayList<Partition> partitions = new ArrayList<>();
if (mCreationMode) {
partitions.addAll(mPartitions);
return partitions;
}
Profile.Section list = mIni.get("partitions");
if (list != null) {
for (Map.Entry<String, String> entry : new TreeMap<>(list).entrySet()) {
Partition partition = new Partition(entry.getKey(), entry.getValue());
try {
if (partition.getType() != Partition.TYPE_BIND)
partition.setSize(RootToolsEx.getFileSize(getDirectory() + "/" + partition.toIniPath()));
} catch (Exception e) {
}
partitions.add(partition);
}
}
return partitions;
}
示例6: parseRemotes
import org.ini4j.Profile; //导入方法依赖的package包/类
@NotNull
private static Pair<Collection<Remote>, Collection<Url>> parseRemotes(@NotNull Ini ini, @NotNull ClassLoader classLoader) {
Collection<Remote> remotes = new ArrayList<Remote>();
Collection<Url> urls = new ArrayList<Url>();
for (Map.Entry<String, Profile.Section> stringSectionEntry : ini.entrySet()) {
String sectionName = stringSectionEntry.getKey();
Profile.Section section = stringSectionEntry.getValue();
Remote remote = parseRemoteSection(sectionName, section, classLoader);
if (remote != null) {
remotes.add(remote);
}
else {
Url url = parseUrlSection(sectionName, section, classLoader);
if (url != null) {
urls.add(url);
}
}
}
return Pair.create(remotes, urls);
}
示例7: configureSubTask
import org.ini4j.Profile; //导入方法依赖的package包/类
@Override
public void configureSubTask(Profile.Section currentSection) {
this.setTimeout(Integer.parseInt(currentSection.get("timeout", "5")));
String action = currentSection.get("action");
if (action == null || action.isEmpty()) {
try {
throw new IntegrationTestException("action for VirtualNetworkFunctionRecordWait not set");
} catch (IntegrationTestException e) {
e.printStackTrace();
log.error(e.getMessage());
System.exit(42);
}
}
this.setAction(Action.valueOf(action));
}
示例8: configureSubTask
import org.ini4j.Profile; //导入方法依赖的package包/类
@Override
public void configureSubTask(Profile.Section currentSection) {
this.setTimeout(Integer.parseInt(currentSection.get("timeout", "5")));
String action = currentSection.get("action");
if (action == null) {
try {
throw new IntegrationTestException("action for NetworkServiceRecordWait not set");
} catch (IntegrationTestException e) {
e.printStackTrace();
log.error(e.getMessage());
System.exit(42);
}
}
this.setAction(Action.valueOf(action));
}
示例9: parseRemotes
import org.ini4j.Profile; //导入方法依赖的package包/类
@NotNull
private static Pair<Collection<Remote>, Collection<Url>> parseRemotes(@NotNull Ini ini, @Nullable ClassLoader classLoader) {
Collection<Remote> remotes = new ArrayList<Remote>();
Collection<Url> urls = new ArrayList<Url>();
for (Map.Entry<String, Profile.Section> stringSectionEntry : ini.entrySet()) {
String sectionName = stringSectionEntry.getKey();
Profile.Section section = stringSectionEntry.getValue();
if (sectionName.startsWith("remote") || sectionName.startsWith("svn-remote")) {
Remote remote = parseRemoteSection(sectionName, section, classLoader);
if (remote != null) {
remotes.add(remote);
}
}
else if (sectionName.startsWith("url")) {
Url url = parseUrlSection(sectionName, section, classLoader);
if (url != null) {
urls.add(url);
}
}
}
return Pair.create(remotes, urls);
}
示例10: validate
import org.ini4j.Profile; //导入方法依赖的package包/类
@Override public void validate(ConfigSchema schema, Ini config) throws ValidationException {
Map<String, ConstraintValidator> validators = collectValidators();
for (Map.Entry<String, Profile.Section> entry : config.entrySet()) {
String groupName = entry.getKey();
Profile.Section section = entry.getValue();
for (String name : section.keySet()) {
SchemaItem item = schema.get(groupName, name);
if (item == null) {
// should not happen
LOGGER.warn("Found configuration item [" + groupName + "] " + name + " without corresponding schema item");
continue;
}
validateItemValues(validators, item, section.getAll(name));
}
}
}
示例11: parseConfig
import org.ini4j.Profile; //导入方法依赖的package包/类
@NotNull
private Map<String, String> parseConfig(@NotNull String content) throws IOException {
@SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
final Ini ini = new Ini(new StringReader(content));
final Map<String, String> result = new HashMap<>();
for (Map.Entry<String, Profile.Section> sectionEntry : ini.entrySet()) {
for (Map.Entry<String, String> configEntry : sectionEntry.getValue().entrySet()) {
String value = configEntry.getValue();
if (value.startsWith("\"") && value.endsWith("\"")) {
value = value.substring(1, value.length() - 1);
}
result.put(sectionEntry.getKey() + ":" + configEntry.getKey(), value);
}
}
return result;
}
示例12: getCfgValue
import org.ini4j.Profile; //导入方法依赖的package包/类
public String getCfgValue(String section, String key) throws NulsException {
Profile.Section ps = ini.get(section);
if (null == ps) {
throw new NulsException(ErrorCode.CONFIGURATION_ITEM_DOES_NOT_EXIST);
}
String value = ps.get(key);
if (StringUtils.isBlank(value)) {
throw new NulsException(ErrorCode.CONFIGURATION_ITEM_DOES_NOT_EXIST);
}
return value;
}
示例13: getSection
import org.ini4j.Profile; //导入方法依赖的package包/类
public Profile.Section getSection(String section) throws NulsException {
Profile.Section ps = ini.get(section);
if (null == ps) {
throw new NulsException(ErrorCode.CONFIGURATION_ITEM_DOES_NOT_EXIST);
}
return ps;
}
示例14: getSectionList
import org.ini4j.Profile; //导入方法依赖的package包/类
public List<String> getSectionList() {
Set<Map.Entry<String, Profile.Section>> entrySet = ini.entrySet();
List<String> list = new ArrayList<>();
for (Map.Entry<String, Profile.Section> entry : entrySet) {
list.add(entry.getKey());
}
return list;
}
示例15: get
import org.ini4j.Profile; //导入方法依赖的package包/类
@Override
public String get(String section, String key) {
Profile.Section section1 = this.sectionMap.get(section);
if (section1 == null) {
System.err.println(
"Couldnt found config section (config file: " + cfgFile.getAbsolutePath() + "): " + section);
}
return section1.get(key);
}