当前位置: 首页>>代码示例>>Java>>正文


Java OptionMap类代码示例

本文整理汇总了Java中org.ini4j.OptionMap的典型用法代码示例。如果您正苦于以下问题:Java OptionMap类的具体用法?Java OptionMap怎么用?Java OptionMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OptionMap类属于org.ini4j包,在下文中一共展示了OptionMap类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addDwarf

import org.ini4j.OptionMap; //导入依赖的package包/类
public static void addDwarf(OptionMap opts, DwarfData dwarf, boolean addNamePrefix)
{
    String prefix = addNamePrefix ? (dwarf.name + '.') : "";

    opts.putComment(prefix + Dwarf.PROP_WEIGHT, " " + dwarf.name);
    inject(opts, dwarf, prefix);
    if (dwarf.name.equals(Dwarfs.PROP_DOPEY))
    {
        opts.put(prefix + Dwarf.PROP_WEIGHT, DwarfsData.OPT_DOPEY_WEIGHT, 0);
        opts.put(prefix + Dwarf.PROP_HEIGHT, DwarfsData.OPT_DOPEY_HEIGHT, 0);
    }
    else if (dwarf.name.equals(Dwarfs.PROP_GRUMPY))
    {
        opts.put(prefix + Dwarf.PROP_HEIGHT, DwarfsData.OPT_GRUMPY_HEIGHT, 0);
    }
    else if (dwarf.name.equals(Dwarfs.PROP_SLEEPY))
    {
        opts.put(prefix + Dwarf.PROP_HEIGHT, DwarfsData.OPT_SLEEPY_HEIGHT, 0);
    }
    else if (dwarf.name.equals(Dwarfs.PROP_SNEEZY))
    {
        opts.put(prefix + Dwarf.PROP_HOME_PAGE, DwarfsData.OPT_SNEEZY_HOME_PAGE, 0);
    }
}
 
开发者ID:JetBrains,项目名称:intellij-deps-ini4j,代码行数:25,代码来源:Helper.java

示例2: inject

import org.ini4j.OptionMap; //导入依赖的package包/类
private static void inject(OptionMap map, Dwarf dwarf, String prefix)
{
    map.put(prefix + Dwarf.PROP_WEIGHT, String.valueOf(dwarf.getWeight()));
    map.put(prefix + Dwarf.PROP_HEIGHT, String.valueOf(dwarf.getHeight()));
    map.put(prefix + Dwarf.PROP_AGE, String.valueOf(dwarf.getAge()));
    map.put(prefix + Dwarf.PROP_HOME_PAGE, dwarf.getHomePage().toString());
    map.put(prefix + Dwarf.PROP_HOME_DIR, dwarf.getHomeDir());
    int[] numbers = dwarf.getFortuneNumber();

    if ((numbers != null) && (numbers.length > 0))
    {
        for (int i = 0; i < numbers.length; i++)
        {
            map.add(prefix + Dwarf.PROP_FORTUNE_NUMBER, String.valueOf(numbers[i]));
        }
    }
}
 
开发者ID:JetBrains,项目名称:intellij-deps-ini4j,代码行数:18,代码来源:Helper.java

示例3: setLdapConfig

import org.ini4j.OptionMap; //导入依赖的package包/类
private void setLdapConfig(LdapAuthServerConfig cfg, OptionMap map) {
    cfg.setMode(MODE_LDAP);
    cfg.setBindDn(map.get(LDAP_BIND_DN));
    cfg.setBindPassword(map.get(LDAP_BIND_PASSWORD));
    cfg.setDomain(map.get(LDAP_DOMAIN));
    try {
        cfg.setLdapUrl(map.get(LDAP_URL, cfg.getLdapUrl()));
    } catch (URISyntaxException e) {
        throw new RuntimeException(e);
    }
    cfg.setUserDnPatterns(map.get(LDAP_USERDN_PATTERNS));
    cfg.setGroupSearchBase(map.get(LDAP_GROUP_SEARCH_BASE));
    cfg.setGroupFilter(map.get(LDAP_GROUP_FILTER, cfg.getGroupFilter()));
    cfg.setUsersOrganizationalUnit(map.get(LDAP_USERS_OU, cfg.getUsersOrganizationalUnit()));
    cfg.setConnectTimeout(map.get(LDAP_CONNECT_TIMEOUT, Long.class, cfg.getConnectTimeout()));
    cfg.setReadTimeout(map.get(LDAP_READ_TIMEOUT, Long.class, cfg.getReadTimeout()));
}
 
开发者ID:Comcast,项目名称:dawg,代码行数:18,代码来源:AuthConfigFactory.java

示例4: createConfig

import org.ini4j.OptionMap; //导入依赖的package包/类
/**
 * Uses 'mode' field to determine which type of config to return.
 * Supported modes are ldap or none. none being default.
 * @param map The map containing all the config values
 * @return
 */
public AuthServerConfig createConfig(OptionMap map) {
    String mode = (String) map.get(AUTH_MODE);
    AuthServerConfig cfg;
    if (MODE_LDAP.equals(mode)) {
        cfg = new LdapAuthServerConfig();
        setBaseConfig(cfg, map);
        setLdapConfig((LdapAuthServerConfig) cfg, map);
    } else {
        cfg = new AuthServerConfig();
        setBaseConfig(cfg, map);
        cfg.setMode(MODE_NONE);
    }
    return cfg;
}
 
开发者ID:Comcast,项目名称:dawg,代码行数:21,代码来源:AuthConfigFactory.java

示例5: setBaseConfig

import org.ini4j.OptionMap; //导入依赖的package包/类
private void setBaseConfig(AuthServerConfig cfg, OptionMap map) {
    cfg.setJwtSecret((String) map.get(JWT_SECRET));
    cfg.setJwtTtl(map.get(JWT_TTL, Long.class, cfg.getJwtTtl()));
    Set<String> domains = map.containsKey(CORS_DOMAINS) ? Sets.newHashSet(map.get(CORS_DOMAINS).split(",")) : null;
    cfg.setCorsDomains(domains);
}
 
开发者ID:Comcast,项目名称:dawg,代码行数:7,代码来源:AuthConfigFactory.java


注:本文中的org.ini4j.OptionMap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。