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


Java Properties.containsKey方法代码示例

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


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

示例1: loadTimeZoneMappings

import java.util.Properties; //导入方法依赖的package包/类
/**
 * Loads a properties file that contains all kinds of time zone mappings.
 * 
 * @param exceptionInterceptor
 * @throws SQLException
 */
private static void loadTimeZoneMappings(ExceptionInterceptor exceptionInterceptor) throws SQLException {
    timeZoneMappings = new Properties();
    try {
        timeZoneMappings.load(TimeUtil.class.getResourceAsStream(TIME_ZONE_MAPPINGS_RESOURCE));
    } catch (IOException e) {
        throw SQLError.createSQLException(Messages.getString("TimeUtil.LoadTimeZoneMappingError"), SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE,
                exceptionInterceptor);
    }
    // bridge all Time Zone ids known by Java
    for (String tz : TimeZone.getAvailableIDs()) {
        if (!timeZoneMappings.containsKey(tz)) {
            timeZoneMappings.put(tz, tz);
        }
    }
}
 
开发者ID:rafallis,项目名称:BibliotecaPS,代码行数:22,代码来源:TimeUtil.java

示例2: loadSettings

import java.util.Properties; //导入方法依赖的package包/类
/**
 * Load proxy or documentation location settings from properties
 */
public void loadSettings() {
    // check if we have saved setings
    File ensembleSettings = new File(System.getProperty("user.home"),".ensemble-settings");
    if (ensembleSettings.exists() && ensembleSettings.isFile()) {
        final Properties settings = new Properties();
        try {
            settings.load(new FileInputStream(ensembleSettings));
            if (settings.containsKey(DOCS_LOCATION)) {
                String location = settings.getProperty(DOCS_LOCATION);
                options.getSelectionModel().select(docsTab);
                localDirPanel.setDocsUrl(location);
                retrieveLocalDocs(location);
            } else if (settings.containsKey(PROXY_ADDRESS) && settings.containsKey(PROXY_PORT)) {
                String address = settings.getProperty(PROXY_ADDRESS);
                String port = settings.getProperty(PROXY_PORT);
                proxyPanel.hostNameBox.setText(address);
                proxyPanel.portBox.setText(port);
                options.getSelectionModel().select(proxyTab);
                setWebProxy(address, port);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:29,代码来源:ProxyDialog.java

示例3: BattleNetAPIInterceptor

import java.util.Properties; //导入方法依赖的package包/类
/**
 * Build an instance of the Interceptor
 * @param bot A instance of the bot.
 */
public BattleNetAPIInterceptor(LegendaryBot bot) {
    this.bot = bot;
    Properties props = new Properties();
    try {
        props.load(new FileInputStream("app.properties"));
        battleNetKey.add(props.getProperty("battlenet.key"));
        for (int i = 2; i<= 10; i++) {
            if (props.containsKey("battlenet"+i+".key")) {
                battleNetKey.add(props.getProperty("battlenet"+i+".key"));
            }
        }

    } catch (IOException e) {
        e.printStackTrace();
        bot.getStacktraceHandler().sendStacktrace(e);
    }
}
 
开发者ID:greatman,项目名称:legendarybot,代码行数:22,代码来源:BattleNetAPIInterceptor.java

示例4: getPropertyInfo

import java.util.Properties; //导入方法依赖的package包/类
public DriverPropertyInfo[] getPropertyInfo(
    String url, Properties info) throws SQLException {
  List<DriverPropertyInfo> list = new ArrayList<DriverPropertyInfo>();

  // First, add the contents of info
  for (Map.Entry<Object, Object> entry : info.entrySet()) {
    list.add(
        new DriverPropertyInfo(
            (String) entry.getKey(),
            (String) entry.getValue()));
  }
  // Next, add property definitions not mentioned in info
  for (ConnectionProperty p : getConnectionProperties()) {
    if (info.containsKey(p.name())) {
      continue;
    }
    list.add(new DriverPropertyInfo(p.name(), null));
  }
  return list.toArray(new DriverPropertyInfo[list.size()]);
}
 
开发者ID:apache,项目名称:calcite-avatica,代码行数:21,代码来源:UnregisteredDriver.java

示例5: getSecurityProperties

import java.util.Properties; //导入方法依赖的package包/类
public static Properties getSecurityProperties() {
  try {
    if (CacheFactory.getAnyInstance() != null
        && CacheFactory.getAnyInstance().getDistributedSystem() != null) {
      Properties securityProperties =
          CacheFactory.getAnyInstance().getDistributedSystem().getSecurityProperties();
      if (securityProperties.containsKey(ENABLE_KERBEROS_AUTHC)
          && Boolean.parseBoolean(securityProperties.getProperty(ENABLE_KERBEROS_AUTHC))) {
        return securityProperties;
      } else {
        return null;
      }
    } else {
      return null;
    }
  } catch (CacheClosedException c) {
    return null;
  }

}
 
开发者ID:ampool,项目名称:monarch,代码行数:21,代码来源:ConfigurationUtils.java

示例6: toAvroType

import java.util.Properties; //导入方法依赖的package包/类
private Type toAvroType(String columnName, int sqlType) {
  Properties mapping = options.getMapColumnJava();

  if (mapping.containsKey(columnName)) {
    String type = mapping.getProperty(columnName);
    if (LOG.isDebugEnabled()) {
      LOG.info("Overriding type of column " + columnName + " to " + type);
    }

    if (type.equalsIgnoreCase("INTEGER")) { return Type.INT; }
    if (type.equalsIgnoreCase("LONG")) { return Type.LONG; }
    if (type.equalsIgnoreCase("BOOLEAN")) { return Type.BOOLEAN; }
    if (type.equalsIgnoreCase("FLOAT")) { return Type.FLOAT; }
    if (type.equalsIgnoreCase("DOUBLE")) { return Type.DOUBLE; }
    if (type.equalsIgnoreCase("STRING")) { return Type.STRING; }
    if (type.equalsIgnoreCase("BYTES")) { return Type.BYTES; }

    // Mapping was not found
    throw new IllegalArgumentException("Cannot convert to AVRO type " + type);
  }

  return connManager.toAvroType(tableName, columnName, sqlType);
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:24,代码来源:AvroSchemaGenerator.java

示例7: getNumber

import java.util.Properties; //导入方法依赖的package包/类
/**
 * 获取数值型属性
 */
public static int getNumber(Properties props, String key) {
    int value = 0;
    if (props.containsKey(key)) {
        value = ConvertUtil.convertToInt(props.getProperty(key));
    }
    return value;
}
 
开发者ID:smxc,项目名称:garlicts,代码行数:11,代码来源:PropertiesLoader.java

示例8: saveFoldersList

import java.util.Properties; //导入方法依赖的package包/类
public boolean saveFoldersList(ArrayList<String> list) throws FileNotFoundException, IOException{
        Properties p = getFoldersList(); 
        String pa = "";
        if(new File(pa).isFile()){
            pa = new File(pa).getParent();
        }
        FileOutputStream f = new FileOutputStream(new File(PATH));
        if(!p.containsKey(pa)){
            p.setProperty(new File(pa).getAbsolutePath(),new File(pa).getName());
        }else{
            return false;
        }
        p.storeToXML(f,null);
        return true;
}
 
开发者ID:Obsidiam,项目名称:joanne,代码行数:16,代码来源:XMLManager.java

示例9: isHostMaster

import java.util.Properties; //导入方法依赖的package包/类
private boolean isHostMaster(String host) {
    if (NonRegisteringDriver.isHostPropertiesList(host)) {
        Properties hostSpecificProps = NonRegisteringDriver.expandHostKeyValues(host);
        if (hostSpecificProps.containsKey("type") && "master".equalsIgnoreCase(hostSpecificProps.get("type").toString())) {
            return true;
        }
    }
    return false;
}
 
开发者ID:rafallis,项目名称:BibliotecaPS,代码行数:10,代码来源:NonRegisteringDriver.java

示例10: saveSystemProIntoMeta

import java.util.Properties; //导入方法依赖的package包/类
/**
 * saveSystemProIntoMeta
 */
private void saveSystemProIntoMeta() {

    Properties systemPros = System.getProperties();
    Map<String, Object> metaMap = new HashMap<String, Object>();
    for (String key : UAVMetaDataMgr.SystemMeta) {

        if (systemPros.containsKey(key)) {
            metaMap.put(key, systemPros.getProperty(key));
        }
    }

    metaMgr.addMetaData(metaMap);
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:17,代码来源:UAVServer.java

示例11: getBoolean

import java.util.Properties; //导入方法依赖的package包/类
/**
 * 获取 boolean 类型属性(可指定默认值)
 */
public static boolean getBoolean(Properties props, String key, boolean defaultValue) {
    boolean value = defaultValue;
    if (props.containsKey(key)) {
        value = CastUtil.castBoolean(props.getProperty(key));
    }
    return value;
}
 
开发者ID:envyandgreed,项目名称:SmartFramework,代码行数:11,代码来源:PropsUtil.java

示例12: newHostInfo

import java.util.Properties; //导入方法依赖的package包/类
static HostInfo newHostInfo(ExecutionEnvironment execEnv, Properties initData, Map<String, String> environment) {
    HostInfoImpl info = new HostInfoImpl();

    OSImpl _os = new OSImpl();
    _os.setBitness(getInt(initData, "BITNESS", 32)); // NOI18N
    _os.setFamily(initData.getProperty("OSFAMILY", UNKNOWN));
    _os.setName(initData.getProperty("OSNAME", UNKNOWN));
    _os.setVersion(initData.getProperty("OSBUILD", UNKNOWN)); // NOI18N
    info.os = _os;

    info.hostname = initData.getProperty("HOSTNAME", UNKNOWN); // NOI18N
    info.cpuFamily = toCpuFamily(initData.getProperty("CPUFAMILY", UNKNOWN)); //NOI18N

    info.loginShell = initData.getProperty("SH", UNKNOWN); // NOI18N
    info.tempDir = initData.getProperty("TMPDIRBASE", UNKNOWN); // NOI18N
    info.userDir = initData.getProperty("USERDIRBASE", UNKNOWN); // NOI18N
    info.cpuNum = getInt(initData, "CPUNUM", 1); // NOI18N

    if (environment == null) {
        info.environment = Collections.unmodifiableMap(Collections.<String, String>emptyMap());
    } else {
        info.environment = Collections.unmodifiableMap(environment);
    }

    if (initData.containsKey("LOCALTIME")) { // NOI18N
        long localTime = (Long) initData.get("LOCALTIME"); // NOI18N
        long remoteTime = getTime(initData, "DATETIME", localTime); // NOI18N
        info.clockSkew = remoteTime - localTime;
    }
    String id = initData.getProperty("ID");
    parseId(info, id);

    // Inherit environment on a localhost ...
    info.envfile = execEnv.isLocal() ? null : info.tempDir + "/env"; // NOI18N
    return info;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:HostInfoFactory.java

示例13: getConfiguration

import java.util.Properties; //导入方法依赖的package包/类
/**
 * Creates the hadoop configuration object from the properties specified for tierstore
 * 
 * @return configuration object
 */
public static Configuration getConfiguration(final Properties props) throws IOException {
  Configuration conf = new Configuration();
  String hdfsSiteXMLPath = props.getProperty(CommonConfig.HDFS_SITE_XML_PATH);
  String hadoopSiteXMLPath = props.getProperty(CommonConfig.HADOOP_SITE_XML_PATH);
  if (hdfsSiteXMLPath != null) {
    conf.addResource(Paths.get(hdfsSiteXMLPath).toUri().toURL());
  }
  if (hadoopSiteXMLPath != null) {
    conf.addResource(Paths.get(hadoopSiteXMLPath).toUri().toURL());
  }

  props.entrySet().forEach((PROP) -> {
    conf.set(String.valueOf(PROP.getKey()), String.valueOf(PROP.getValue()));
  });

  // set secured properties
  String userName = props.getProperty(CommonConfig.USER_NAME);
  String keytabPath = props.getProperty(CommonConfig.KEYTAB_PATH);
  if (userName == null || keytabPath == null) {
    if (props.containsKey(ENABLE_KERBEROS_AUTHC)
        && Boolean.parseBoolean(props.getProperty(ENABLE_KERBEROS_AUTHC))) {
      userName = props.getProperty(ResourceConstants.USER_NAME);
      keytabPath = props.getProperty(ResourceConstants.PASSWORD);
    }
  }

  // use the username and keytab
  if (userName != null && keytabPath != null) {
    // set kerberos authentication
    conf.set("hadoop.security.authentication", "kerberos");
    UserGroupInformation.setConfiguration(conf);
    UserGroupInformation.loginUserFromKeytab(userName, keytabPath);
  }
  return conf;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:41,代码来源:ConfigurationUtils.java

示例14: onConfigUpdate

import java.util.Properties; //导入方法依赖的package包/类
@Override
public void onConfigUpdate(Properties updatedConfig) {

    if (updatedConfig.containsKey("feature.monitoragent.detector.container.ports")) {
        String ports = (String) updatedConfig.get("feature.monitoragent.detector.container.ports");

        configScanPorts(ports);
    }
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:10,代码来源:JVMContainerOSDetector.java

示例15: checkReleaseProperty

import java.util.Properties; //导入方法依赖的package包/类
static void checkReleaseProperty(Properties props, String name) {
    if (! props.containsKey(name)) {
        throw new AssertionError("release file does not contain property : " + name);
    }

    // property value is of min. length 3 and double quoted at the ends.
    String value = props.getProperty(name);
    if (value.length() < 3 ||
        value.charAt(0) != '"' ||
        value.charAt(value.length() - 1) != '"') {
        throw new AssertionError("release property " + name + " is not quoted property");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:IntegrationTest.java


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