當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。