azkaban.utils.Props.containsKey()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(134)

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

Props.containsKey介绍

[英]Check key in current Props then search in parent
[中]选中当前道具中的键,然后搜索父项

代码示例

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

/**
 * Check key in current Props then search in parent
 */
public boolean containsKey(final Object k) {
 return this._current.containsKey(k)
   || (this._parent != null && this._parent.containsKey(k));
}

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

public boolean loadProjectWhiteList() {
  if (this.props.containsKey(ProjectWhitelist.XML_FILE_PARAM)) {
   ProjectWhitelist.load(this.props);
   return true;
  }
  return false;
 }
}

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

/**
 * Returns the double representation of the value. If the value is null, then the default value is
 * returned. If the value isn't a double, then a parse exception will be thrown.
 */
public double getDouble(final String name, final double defaultValue) {
 if (containsKey(name)) {
  return Double.parseDouble(get(name).trim());
 } else {
  return defaultValue;
 }
}

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

/**
 * Gets the class from the Props. If it doesn't exist, it will return the defaultClass
 */
public Class<?> getClass(final String key, final Class<?> defaultClass) {
 if (containsKey(key)) {
  return getClass(key);
 } else {
  return defaultClass;
 }
}

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

/**
 * Gets the string from the Props. If it doesn't exist, it will return the defaultValue
 */
public String getString(final String key, final String defaultValue) {
 if (containsKey(key)) {
  return get(key);
 } else {
  return defaultValue;
 }
}

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

/**
 * Returns a list of strings with the sep as the separator of the value. If the value is null,
 * it'll return the defaultValue.
 */
public List<String> getStringList(final String key, final List<String> defaultValue,
  final String sep) {
 if (containsKey(key)) {
  return getStringList(key, sep);
 } else {
  return defaultValue;
 }
}

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

/**
 * Returns true if the value equals "true". If the value is null, then the default value is
 * returned.
 */
public boolean getBoolean(final String key, final boolean defaultValue) {
 if (containsKey(key)) {
  return "true".equalsIgnoreCase(get(key).trim());
 } else {
  return defaultValue;
 }
}

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

/**
 * Returns the long representation of the value. If the value is null, then the default value is
 * returned. If the value isn't a long, then a parse exception will be thrown.
 */
public long getLong(final String name, final long defaultValue) {
 if (containsKey(name)) {
  return Long.parseLong(get(name));
 } else {
  return defaultValue;
 }
}

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

/**
 * Returns the int representation of the value. If the value is null, then the default value is
 * returned. If the value isn't a int, then a parse exception will be thrown.
 */
public int getInt(final String name, final int defaultValue) {
 if (containsKey(name)) {
  return Integer.parseInt(get(name).trim());
 } else {
  return defaultValue;
 }
}

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

/**
 * Returns the double representation of the value. If the value is null, then the default value is
 * returned. If the value isn't a uri, then a IllegalArgumentException will be thrown.
 */
public URI getUri(final String name, final URI defaultValue) {
 if (containsKey(name)) {
  return getUri(name);
 } else {
  return defaultValue;
 }
}

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

/**
 * Returns a list of strings with the comma as the separator of the value. If the value is null,
 * it'll return the defaultValue.
 */
public List<String> getStringList(final String key, final List<String> defaultValue) {
 if (containsKey(key)) {
  return getStringList(key);
 } else {
  return defaultValue;
 }
}

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

protected List<String> getCommandList() {
 final List<String> commands = new ArrayList<>();
 commands.add(this.jobProps.getString(COMMAND));
 for (int i = 1; this.jobProps.containsKey(COMMAND + "." + i); i++) {
  commands.add(this.jobProps.getString(COMMAND + "." + i));
 }
 return commands;
}

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

public Class<?> getClass(final String key, final boolean initialize, final ClassLoader cl) {
 try {
  if (containsKey(key)) {
   return Class.forName(get(key), initialize, cl);
  } else {
   throw new UndefinedPropertyException("Missing required property '"
     + key + "'");
  }
 } catch (final ClassNotFoundException e) {
  throw new IllegalArgumentException(e);
 }
}

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

/**
 * Returns the int representation of the value. If the value is null, then a
 * UndefinedPropertyException will be thrown. If the value isn't a int, then a parse exception
 * will be thrown.
 */
public int getInt(final String name) {
 if (containsKey(name)) {
  return Integer.parseInt(get(name).trim());
 } else {
  throw new UndefinedPropertyException("Missing required property '" + name
    + "'");
 }
}

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

/**
 * Returns the double representation of the value. If the value is null, then a
 * UndefinedPropertyException will be thrown. If the value isn't a double, then a parse exception
 * will be thrown.
 */
public double getDouble(final String name) {
 if (containsKey(name)) {
  return Double.parseDouble(get(name).trim());
 } else {
  throw new UndefinedPropertyException("Missing required property '" + name
    + "'");
 }
}

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

/**
 * Returns true if the value equals "true". If the value is null, then an
 * UndefinedPropertyException is thrown.
 */
public boolean getBoolean(final String key) {
 if (containsKey(key)) {
  return "true".equalsIgnoreCase(get(key));
 } else {
  throw new UndefinedPropertyException("Missing required property '" + key
    + "'");
 }
}

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

/**
 * Returns the long representation of the value. If the value is null, then a
 * UndefinedPropertyException will be thrown. If the value isn't a long, then a parse exception
 * will be thrown.
 */
public long getLong(final String name) {
 if (containsKey(name)) {
  return Long.parseLong(get(name));
 } else {
  throw new UndefinedPropertyException("Missing required property '" + name
    + "'");
 }
}

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

public static String getExternalLogViewer(final Props azkProps, final String jobId,
  final Props jobProps) {
 // If no topic was configured to be an external analyzer, return empty
 if (!azkProps
   .containsKey(Constants.ConfigurationKeys.AZKABAN_SERVER_EXTERNAL_LOGVIEWER_TOPIC)) {
  return "";
 }
 // Find out which external link we should use to lead to our log viewer
 final String topic = azkProps
   .getString(Constants.ConfigurationKeys.AZKABAN_SERVER_EXTERNAL_LOGVIEWER_TOPIC);
 return getLinkFromJobAndExecId(topic, azkProps, jobId, jobProps);
}

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

/**
 * Gets the string from the Props. If it doesn't exist, throw and UndefinedPropertiesException
 */
public String getString(final String key) {
 if (containsKey(key)) {
  return get(key);
 } else {
  throw new UndefinedPropertyException("Missing required property '" + key
    + "'");
 }
}

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

public static String getExternalAnalyzerOnReq(final Props azkProps,
  final HttpServletRequest req) {
 // If no topic was configured to be an external analyzer, return empty
 if (!azkProps.containsKey(Constants.ConfigurationKeys.AZKABAN_SERVER_EXTERNAL_ANALYZER_TOPIC)) {
  return "";
 }
 // Find out which external link we should use to lead to our analyzer
 final String topic = azkProps
   .getString(Constants.ConfigurationKeys.AZKABAN_SERVER_EXTERNAL_ANALYZER_TOPIC);
 return getLinkFromRequest(topic, azkProps, req);
}

相关文章