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


Java PropertiesConfiguration.getProperty方法代码示例

本文整理汇总了Java中org.apache.commons.configuration2.PropertiesConfiguration.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java PropertiesConfiguration.getProperty方法的具体用法?Java PropertiesConfiguration.getProperty怎么用?Java PropertiesConfiguration.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.configuration2.PropertiesConfiguration的用法示例。


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

示例1: checkRole

import org.apache.commons.configuration2.PropertiesConfiguration; //导入方法依赖的package包/类
private void checkRole(String user, File roleFile, String... roles) throws Exception {
   Configurations configs = new Configurations();
   FileBasedConfigurationBuilder<PropertiesConfiguration> roleBuilder = configs.propertiesBuilder(roleFile);
   PropertiesConfiguration roleConfig = roleBuilder.getConfiguration();

   for (String r : roles) {
      String storedUsers = (String) roleConfig.getProperty(r);

      System.out.println("users in role: " + r + " ; " + storedUsers);
      List<String> userList = StringUtil.splitStringList(storedUsers, ",");
      assertTrue(userList.contains(user));
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:14,代码来源:ArtemisTest.java

示例2: checkPassword

import org.apache.commons.configuration2.PropertiesConfiguration; //导入方法依赖的package包/类
private boolean checkPassword(String user, String password, File userFile) throws Exception {
   Configurations configs = new Configurations();
   FileBasedConfigurationBuilder<PropertiesConfiguration> userBuilder = configs.propertiesBuilder(userFile);
   PropertiesConfiguration userConfig = userBuilder.getConfiguration();
   String storedPassword = (String) userConfig.getProperty(user);
   HashProcessor processor = PasswordMaskingUtil.getHashProcessor(storedPassword);
   return processor.compare(password.toCharArray(), storedPassword);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:9,代码来源:ArtemisTest.java

示例3: mergeExtraOptions

import org.apache.commons.configuration2.PropertiesConfiguration; //导入方法依赖的package包/类
private static void mergeExtraOptions(PropertiesConfiguration baseOptions, PropertiesConfiguration extraOptions) {
  if (isNull(extraOptions) || extraOptions.size() == 0) {
    return;
  }
  trace("loadOptions: have to merge extra Options");
  Iterator<String> allKeys = extraOptions.getKeys();
  while (allKeys.hasNext()) {
    String key = allKeys.next();
    if ("sxversion".equals(key)) {
      baseOptions.setProperty("sxversion_saved", extraOptions.getProperty(key));
      continue;
    }
    if ("sxbuild".equals(key)) {
      baseOptions.setProperty("sxbuild_saved", extraOptions.getProperty(key));
      continue;
    }
    Object value = baseOptions.getProperty(key);
    if (isNull(value)) {
      baseOptions.addProperty(key, extraOptions.getProperty(key));
      trace("Option added: %s", key);
    } else {
      Object extraValue = extraOptions.getProperty(key);
      if (!value.getClass().getName().equals(extraValue.getClass().getName()) ||
              !value.toString().equals(extraValue.toString())) {
        baseOptions.setProperty(key, extraValue);
        trace("Option changed: %s = %s", key, extraValue);
      }
    }
  }
}
 
开发者ID:RaiMan,项目名称:SikuliX2,代码行数:31,代码来源:SX.java


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