org.apache.flink.configuration.Configuration.getRawValue()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(193)

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

Configuration.getRawValue介绍

暂无

代码示例

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

/**
 * Returns the value associated with the given key as a string.
 *
 * @param key
 *        the key pointing to the associated value
 * @param defaultValue
 *        the default value which is returned in case there is no value associated with the given key
 * @return the (default) value associated with the given key
 */
public String getString(String key, String defaultValue) {
  Object o = getRawValue(key);
  if (o == null) {
    return defaultValue;
  } else {
    return o.toString();
  }
}

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

/**
 * Returns the class associated with the given key as a string.
 *
 * @param <T> The type of the class to return.
 * @param key The key pointing to the associated value
 * @param defaultValue The optional default value returned if no entry exists
 * @param classLoader The class loader used to resolve the class.
 *
 * @return The value associated with the given key, or the default value, if to entry for the key exists.
 */
@SuppressWarnings("unchecked")
public <T> Class<T> getClass(String key, Class<? extends T> defaultValue, ClassLoader classLoader) throws ClassNotFoundException {
  Object o = getRawValue(key);
  if (o == null) {
    return (Class<T>) defaultValue;
  }
  if (o.getClass() == String.class) {
    return (Class<T>) Class.forName((String) o, true, classLoader);
  }
  LOG.warn("Configuration cannot evaluate value " + o + " as a class name");
  return (Class<T>) defaultValue;
}

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

/**
 * Returns the value associated with the given key as a byte array.
 *
 * @param key
 *        The key pointing to the associated value.
 * @param defaultValue
 *        The default value which is returned in case there is no value associated with the given key.
 * @return the (default) value associated with the given key.
 */
@SuppressWarnings("EqualsBetweenInconvertibleTypes")
public byte[] getBytes(String key, byte[] defaultValue) {
  Object o = getRawValue(key);
  if (o == null) {
    return defaultValue;
  }
  else if (o.getClass().equals(byte[].class)) {
    return (byte[]) o;
  }
  else {
    LOG.warn("Configuration cannot evaluate value {} as a byte[] value", o);
    return defaultValue;
  }
}

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

/**
 * Returns the value associated with the given key as a boolean.
 *
 * @param key
 *        the key pointing to the associated value
 * @param defaultValue
 *        the default value which is returned in case there is no value associated with the given key
 * @return the (default) value associated with the given key
 */
public boolean getBoolean(String key, boolean defaultValue) {
  Object o = getRawValue(key);
  if (o == null) {
    return defaultValue;
  }
  return convertToBoolean(o);
}

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

/**
 * Returns the value associated with the given key as an integer.
 *
 * @param key
 *        the key pointing to the associated value
 * @param defaultValue
 *        the default value which is returned in case there is no value associated with the given key
 * @return the (default) value associated with the given key
 */
public int getInteger(String key, int defaultValue) {
  Object o = getRawValue(key);
  if (o == null) {
    return defaultValue;
  }
  return convertToInt(o, defaultValue);
}

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

/**
 * Returns the value associated with the given key as a float.
 *
 * @param key
 *        the key pointing to the associated value
 * @param defaultValue
 *        the default value which is returned in case there is no value associated with the given key
 * @return the (default) value associated with the given key
 */
public float getFloat(String key, float defaultValue) {
  Object o = getRawValue(key);
  if (o == null) {
    return defaultValue;
  }
  return convertToFloat(o, defaultValue);
}

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

/**
 * Returns the value associated with the given key as a double.
 *
 * @param key
 *        the key pointing to the associated value
 * @param defaultValue
 *        the default value which is returned in case there is no value associated with the given key
 * @return the (default) value associated with the given key
 */
public double getDouble(String key, double defaultValue) {
  Object o = getRawValue(key);
  if (o == null) {
    return defaultValue;
  }
  return convertToDouble(o, defaultValue);
}

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

/**
 * Returns the value associated with the given key as a long.
 *
 * @param key
 *        the key pointing to the associated value
 * @param defaultValue
 *        the default value which is returned in case there is no value associated with the given key
 * @return the (default) value associated with the given key
 */
public long getLong(String key, long defaultValue) {
  Object o = getRawValue(key);
  if (o == null) {
    return defaultValue;
  }
  return convertToLong(o, defaultValue);
}

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

private Object getRawValueFromOption(ConfigOption<?> configOption) {
  // first try the current key
  Object o = getRawValue(configOption.key());
  if (o != null) {
    // found a value for the current proper key
    return o;
  }
  else if (configOption.hasFallbackKeys()) {
    // try the deprecated keys
    for (FallbackKey fallbackKey : configOption.fallbackKeys()) {
      Object oo = getRawValue(fallbackKey.getKey());
      if (oo != null) {
        loggingFallback(fallbackKey, configOption);
        return oo;
      }
    }
  }
  return null;
}

代码示例来源:origin: org.apache.flink/flink-core

/**
 * Returns the value associated with the given key as a string.
 *
 * @param key
 *        the key pointing to the associated value
 * @param defaultValue
 *        the default value which is returned in case there is no value associated with the given key
 * @return the (default) value associated with the given key
 */
public String getString(String key, String defaultValue) {
  Object o = getRawValue(key);
  if (o == null) {
    return defaultValue;
  } else {
    return o.toString();
  }
}

代码示例来源:origin: com.alibaba.blink/flink-core

/**
 * Returns the value associated with the given key as a float.
 *
 * @param key
 *        the key pointing to the associated value
 * @param defaultValue
 *        the default value which is returned in case there is no value associated with the given key
 * @return the (default) value associated with the given key
 */
public float getFloat(String key, float defaultValue) {
  Object o = getRawValue(key);
  if (o == null) {
    return defaultValue;
  }
  return convertToFloat(o, defaultValue);
}

代码示例来源:origin: org.apache.flink/flink-core

/**
 * Returns the value associated with the given key as a boolean.
 *
 * @param key
 *        the key pointing to the associated value
 * @param defaultValue
 *        the default value which is returned in case there is no value associated with the given key
 * @return the (default) value associated with the given key
 */
public boolean getBoolean(String key, boolean defaultValue) {
  Object o = getRawValue(key);
  if (o == null) {
    return defaultValue;
  }
  return convertToBoolean(o);
}

代码示例来源:origin: com.alibaba.blink/flink-core

/**
 * Returns the value associated with the given key as a double.
 *
 * @param key
 *        the key pointing to the associated value
 * @param defaultValue
 *        the default value which is returned in case there is no value associated with the given key
 * @return the (default) value associated with the given key
 */
public double getDouble(String key, double defaultValue) {
  Object o = getRawValue(key);
  if (o == null) {
    return defaultValue;
  }
  return convertToDouble(o, defaultValue);
}

代码示例来源:origin: org.apache.flink/flink-core

/**
 * Returns the value associated with the given key as an integer.
 *
 * @param key
 *        the key pointing to the associated value
 * @param defaultValue
 *        the default value which is returned in case there is no value associated with the given key
 * @return the (default) value associated with the given key
 */
public int getInteger(String key, int defaultValue) {
  Object o = getRawValue(key);
  if (o == null) {
    return defaultValue;
  }
  return convertToInt(o, defaultValue);
}

代码示例来源:origin: com.alibaba.blink/flink-core

/**
 * Returns the value associated with the given key as a boolean.
 *
 * @param key
 *        the key pointing to the associated value
 * @param defaultValue
 *        the default value which is returned in case there is no value associated with the given key
 * @return the (default) value associated with the given key
 */
public boolean getBoolean(String key, boolean defaultValue) {
  Object o = getRawValue(key);
  if (o == null) {
    return defaultValue;
  }
  return convertToBoolean(o);
}

代码示例来源:origin: org.apache.flink/flink-core

/**
 * Returns the value associated with the given key as a float.
 *
 * @param key
 *        the key pointing to the associated value
 * @param defaultValue
 *        the default value which is returned in case there is no value associated with the given key
 * @return the (default) value associated with the given key
 */
public float getFloat(String key, float defaultValue) {
  Object o = getRawValue(key);
  if (o == null) {
    return defaultValue;
  }
  return convertToFloat(o, defaultValue);
}

代码示例来源:origin: com.alibaba.blink/flink-core

/**
 * Returns the value associated with the given key as an integer.
 *
 * @param key
 *        the key pointing to the associated value
 * @param defaultValue
 *        the default value which is returned in case there is no value associated with the given key
 * @return the (default) value associated with the given key
 */
public int getInteger(String key, int defaultValue) {
  Object o = getRawValue(key);
  if (o == null) {
    return defaultValue;
  }
  return convertToInt(o, defaultValue);
}

代码示例来源:origin: com.alibaba.blink/flink-core

/**
 * Returns the value associated with the given key as a long.
 *
 * @param key
 *        the key pointing to the associated value
 * @param defaultValue
 *        the default value which is returned in case there is no value associated with the given key
 * @return the (default) value associated with the given key
 */
public long getLong(String key, long defaultValue) {
  Object o = getRawValue(key);
  if (o == null) {
    return defaultValue;
  }
  return convertToLong(o, defaultValue);
}

代码示例来源:origin: org.apache.flink/flink-core

/**
 * Returns the value associated with the given key as a long.
 *
 * @param key
 *        the key pointing to the associated value
 * @param defaultValue
 *        the default value which is returned in case there is no value associated with the given key
 * @return the (default) value associated with the given key
 */
public long getLong(String key, long defaultValue) {
  Object o = getRawValue(key);
  if (o == null) {
    return defaultValue;
  }
  return convertToLong(o, defaultValue);
}

代码示例来源:origin: org.apache.flink/flink-core

/**
 * Returns the value associated with the given key as a double.
 *
 * @param key
 *        the key pointing to the associated value
 * @param defaultValue
 *        the default value which is returned in case there is no value associated with the given key
 * @return the (default) value associated with the given key
 */
public double getDouble(String key, double defaultValue) {
  Object o = getRawValue(key);
  if (o == null) {
    return defaultValue;
  }
  return convertToDouble(o, defaultValue);
}

相关文章