java.util.Properties.contains()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(9.8k)|赞(0)|评价(0)|浏览(167)

本文整理了Java中java.util.Properties.contains()方法的一些代码示例,展示了Properties.contains()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Properties.contains()方法的具体详情如下:
包路径:java.util.Properties
类名称:Properties
方法名:contains

Properties.contains介绍

暂无

代码示例

代码示例来源:origin: apache/hive

@Override
public synchronized boolean contains(Object value) {
 if (interned != null) return interned.contains(value);
 else return super.contains(value);
}

代码示例来源:origin: apache/incubator-gobblin

public FileSystem getFsForDataset(Path path) throws IOException {
  Preconditions.checkArgument(this.props.containsKey(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS));
  Preconditions.checkArgument(this.props.containsKey(ConfigurationKeys.SUPER_USER_KEY_TAB_LOCATION));
  FileSystem proxiedFileSystem = this.fs;
  try {
   proxiedFileSystem = ProxiedFileSystemCache.getProxiedFileSystemUsingKeytab(this.fs.getFileStatus(path).getOwner(),
     this.props.getProperty(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS),
     new Path(this.props.getProperty(ConfigurationKeys.SUPER_USER_KEY_TAB_LOCATION)), this.fs.getUri(),
     this.fs.getConf());
  } catch (ExecutionException e) {
   throw new IOException("Cannot get proxied filesystem at Path: " + path, e);
  }

  if (this.props.contains(DatasetCleaner.DATASET_CLEAN_HDFS_CALLS_PER_SECOND_LIMIT)) {
   return new RateControlledFileSystem(proxiedFileSystem,
     Long.parseLong(this.props.getProperty(DatasetCleaner.DATASET_CLEAN_HDFS_CALLS_PER_SECOND_LIMIT)));
  }
  return proxiedFileSystem;
 }
}

代码示例来源:origin: apache/incubator-gobblin

try {
 FileSystem optionalRateControlledFs = targetFs;
 if (props.contains(DATASET_CLEAN_HDFS_CALLS_PER_SECOND_LIMIT)) {
  optionalRateControlledFs = this.closer.register(new RateControlledFileSystem(targetFs,
    Long.parseLong(props.getProperty(DATASET_CLEAN_HDFS_CALLS_PER_SECOND_LIMIT))));

代码示例来源:origin: alibaba/TProfiler

public boolean contains(Object value) {
 return delegate.contains(value);
}

代码示例来源:origin: alibaba/druid

public String getProperties() {
  if (this.properties == null) {
    return null;
  }
  Properties properties = new Properties(this.properties);
  if (properties.contains("password")) {
    properties.put("password", "******");
  }
  return properties.toString();
}

代码示例来源:origin: ninjaframework/ninja

/**
 * check the mimetype is referenced in the mimetypes database
 * 
 * @param mimeType
 *            the mimeType to verify
 */
public boolean isValidMimeType(String mimeType) {
  if (mimeType == null) {
    return false;
  } else if (mimeType.indexOf(";") != -1) {
    return mimetypes.contains(mimeType.split(";")[0]);
  } else {
    return mimetypes.contains(mimeType);
  }
}

代码示例来源:origin: OpenHFT/Chronicle-Queue

public boolean checkInterrupts() {
  if (checkInterrupts == null) {
    if (System.getProperties().contains("chronicle.queue.ignoreInterrupts"))
      return !Boolean.getBoolean("chronicle.queue.ignoreInterrupts");
    if (System.getProperties().contains("chronicle.queue.checkInterrupts"))
      return Boolean.getBoolean("chronicle.queue.checkInterrupts");
  }
  // default is true unless turned off.
  return !Boolean.FALSE.equals(checkInterrupts);
}

代码示例来源:origin: knightliao/disconf

public boolean contains(Object value) {
  return getDelegate().contains(value);
}

代码示例来源:origin: apache/storm

@Override
  public IRichBolt getConsumer() {
    Preconditions.checkArgument(!props.isEmpty(), "Writable MongoDB must contain collection config");
    String serField;
    if (props.contains(VALUE_SERIALIZED_FIELD)) {
      serField = props.getProperty(VALUE_SERIALIZED_FIELD);
    } else if (props.contains(TRIDENT_VALUE_SERIALIZED_FIELD)) {
      // backward compatibility
      serField = props.getProperty(TRIDENT_VALUE_SERIALIZED_FIELD);
    } else {
      serField = DEFAULT_VALUE_SERIALIZED_FIELD;
    }
    MongoMapper mapper = new SqlMongoMapper(serField, serializer);
    return new MongoInsertBolt(url, props.getProperty(COLLECTION_NAME), mapper);
  }
}

代码示例来源:origin: apache/geode

public static Properties getAllDistributedSystemProperties(final Properties properties) {
 Properties dsProperties = DUnitEnv.get().getDistributedSystemProperties();
 // our tests do not expect auto-reconnect to be on by default
 if (!dsProperties.contains(DISABLE_AUTO_RECONNECT)) {
  dsProperties.put(DISABLE_AUTO_RECONNECT, "true");
 }
 for (Map.Entry<Object, Object> entry : properties.entrySet()) {
  String key = (String) entry.getKey();
  Object value = entry.getValue();
  dsProperties.put(key, value);
 }
 System.out.println("distributed system properties: " + dsProperties);
 return dsProperties;
}

代码示例来源:origin: marytts/marytts

/**
 * Get a property from the underlying properties.
 * 
 * @param key
 *            the property key requested
 * @param defaultValue
 *            the value to return if the property is not defined
 * @return the property value if found, defaultValue otherwise.
 */
public String getProperty(String key, String defaultValue) {
  String value;
  if (isSystemOverrides && System.getProperties().contains(key)) {
    value = System.getProperty(key);
  } else {
    value = p.getProperty(key, defaultValue);
  }
  if (value != null && replacements != null) {
    for (String s : replacements.keySet()) {
      if (value.contains(s)) {
        value = value.replace(s, replacements.get(s));
      }
    }
  }
  return value;
}

代码示例来源:origin: marytts/marytts

/**
 * Get a property from the underlying properties.
 * 
 * @param key
 *            the property key requested
 * @param defaultValue
 *            the value to return if the property is not defined
 * @return the property value if found, defaultValue otherwise.
 */
public String getProperty(String key, String defaultValue) {
  String value;
  if (isSystemOverrides && System.getProperties().contains(key)) {
    value = System.getProperty(key);
  } else {
    value = p.getProperty(key, defaultValue);
  }
  if (value != null && replacements != null) {
    for (String s : replacements.keySet()) {
      if (value.contains(s)) {
        value = value.replace(s, replacements.get(s));
      }
    }
  }
  return value;
}

代码示例来源:origin: apache/incubator-gobblin

/**
 * Uses the properties {@link ConfigurationKeys#AZKABAN_EXECUTION_DAYS_LIST},
 * {@link ConfigurationKeys#AZKABAN_EXECUTION_TIME_RANGE}, and
 * {@link TimeRangeChecker#isTimeInRange(List, String, String, DateTime)} to determine if the current job should
 * continue its execution based on the extra scheduled parameters defined in the config.
 *
 * @return true if this job should be launched, false otherwise.
 */
private boolean isCurrentTimeInRange() {
 Splitter splitter = Splitter.on(",").omitEmptyStrings().trimResults();
 if (this.props.contains(ConfigurationKeys.AZKABAN_EXECUTION_DAYS_LIST) && this.props
   .contains(ConfigurationKeys.AZKABAN_EXECUTION_TIME_RANGE)) {
  List<String> executionTimeRange =
    splitter.splitToList(this.props.getProperty(ConfigurationKeys.AZKABAN_EXECUTION_TIME_RANGE));
  List<String> executionDays =
    splitter.splitToList(this.props.getProperty(ConfigurationKeys.AZKABAN_EXECUTION_DAYS_LIST));
  Preconditions.checkArgument(executionTimeRange.size() == 2,
    "The property " + ConfigurationKeys.AZKABAN_EXECUTION_DAYS_LIST
      + " should be a comma separated list of two entries");
  return TimeRangeChecker.isTimeInRange(executionDays, executionTimeRange.get(0), executionTimeRange.get(1),
    new DateTime(DateTimeZone.forID(ConfigurationKeys.PST_TIMEZONE_NAME)));
 }
 return true;
}

代码示例来源:origin: apache/flink

/**
 * Sets all deprecated properties that are not currently set but have a
 * corresponding new property that is set. Useful for iterating the
 * properties when all deprecated properties for currently set properties
 * need to be present.
 */
public void setDeprecatedProperties() {
  DeprecationContext deprecations = deprecationContext.get();
  Properties props = getProps();
  Properties overlay = getOverlay();
  for (Map.Entry<String, DeprecatedKeyInfo> entry :
      deprecations.getDeprecatedKeyMap().entrySet()) {
    String depKey = entry.getKey();
    if (!overlay.contains(depKey)) {
      for (String newKey : entry.getValue().newKeys) {
        String val = overlay.getProperty(newKey);
        if (val != null) {
          props.setProperty(depKey, val);
          overlay.setProperty(depKey, val);
          break;
        }
      }
    }
  }
}

代码示例来源:origin: apache/flink

/**
 * Sets all deprecated properties that are not currently set but have a
 * corresponding new property that is set. Useful for iterating the
 * properties when all deprecated properties for currently set properties
 * need to be present.
 */
public void setDeprecatedProperties() {
 DeprecationContext deprecations = deprecationContext.get();
 Properties props = getProps();
 Properties overlay = getOverlay();
 for (Entry<String, DeprecatedKeyInfo> entry :
   deprecations.getDeprecatedKeyMap().entrySet()) {
  String depKey = entry.getKey();
  if (!overlay.contains(depKey)) {
   for (String newKey : entry.getValue().newKeys) {
    String val = overlay.getProperty(newKey);
    if (val != null) {
     props.setProperty(depKey, val);
     overlay.setProperty(depKey, val);
     break;
    }
   }
  }
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-common

/**
 * Sets all deprecated properties that are not currently set but have a
 * corresponding new property that is set. Useful for iterating the
 * properties when all deprecated properties for currently set properties
 * need to be present.
 */
public void setDeprecatedProperties() {
 DeprecationContext deprecations = deprecationContext.get();
 Properties props = getProps();
 Properties overlay = getOverlay();
 for (Map.Entry<String, DeprecatedKeyInfo> entry :
   deprecations.getDeprecatedKeyMap().entrySet()) {
  String depKey = entry.getKey();
  if (!overlay.contains(depKey)) {
   for (String newKey : entry.getValue().newKeys) {
    String val = overlay.getProperty(newKey);
    if (val != null) {
     props.setProperty(depKey, val);
     overlay.setProperty(depKey, val);
     break;
    }
   }
  }
 }
}

代码示例来源:origin: wildfly/wildfly

if (!props.contains(prop.getKey())) {
  if (prop.getKey().contains(".")){
    props.put(prop.getKey(), prop.getValue());

代码示例来源:origin: stanfordnlp/CoreNLP

boolean shouldDistribute = dsParams.contains(ConfigParser.paramDistrib) &&
    Boolean.parseBoolean(dsParams.getProperty(ConfigParser.paramDistrib));
dsParams.remove(ConfigParser.paramDistrib);

代码示例来源:origin: apache/geode

/**
 * Launch DUnit. If the unit test was launched through the hydra framework, leave the test alone.
 */
public static void launchIfNeeded() {
 if (System.getProperties().contains(VM_NUM_PARAM)) {
  // we're a dunit child vm, do nothing.
  return;
 }
 if (!isHydra() && !isLaunched()) {
  try {
   launch();
  } catch (Exception e) {
   throw new RuntimeException("Unable to launch dunit VMs", e);
  }
 }
 Host.setAllVMsToCurrentVersion();
}

代码示例来源:origin: apache/incubator-gobblin

if (!properties.contains(ServiceBasedAppLauncher.APP_STOP_TIME_SECONDS)) {
 properties.setProperty(ServiceBasedAppLauncher.APP_STOP_TIME_SECONDS, Long.toString(300));

相关文章

微信公众号

最新文章

更多