org.springframework.batch.item.ExecutionContext.getDouble()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(117)

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

ExecutionContext.getDouble介绍

[英]Typesafe Getter for the Double represented by the provided key.
[中]由提供的键表示的Double的Typesafe Getter。

代码示例

代码示例来源:origin: spring-projects/spring-batch

/**
 * Typesafe Getter for the Double represented by the provided key with
 * default value to return if key is not represented.
 *
 * @param key The key to get a value for
 * @param defaultDouble Default to return if key is not represented
 * @return The <code>double</code> value if key is represented, specified
 * default otherwise
 */
public double getDouble(String key, double defaultDouble) {
  if (!containsKey(key)) {
    return defaultDouble;
  }
  return getDouble(key);
}

代码示例来源:origin: spring-projects/spring-batch

@Test
public void testInvalidCast() {
  context.putLong("1", 1);
  try {
    context.getDouble("1");
    fail();
  }
  catch (ClassCastException ex) {
    // expected
  }
}

代码示例来源:origin: spring-projects/spring-batch

key = key.replace("(double)", "");
if (executionContext.containsKey(key)) {
  builder.addDouble(key, executionContext.getDouble(key));

代码示例来源:origin: spring-projects/spring-batch

@Test
public void testNormalUsage() {
  context.putString("1", "testString1");
  context.putString("2", "testString2");
  context.putLong("3", 3);
  context.putDouble("4", 4.4);
  context.putInt("5", 5);
  assertEquals("testString1", context.getString("1"));
  assertEquals("testString2", context.getString("2"));
  assertEquals("defaultString", context.getString("55", "defaultString"));
  assertEquals(4.4, context.getDouble("4"), 0);
  assertEquals(5.5, context.getDouble("55", 5.5), 0);
  assertEquals(3, context.getLong("3"));
  assertEquals(5, context.getLong("55", 5));
  assertEquals(5, context.getInt("5"));
  assertEquals(6, context.getInt("55", 6));
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Typesafe Getter for the Double represented by the provided key with
 * default value to return if key is not represented.
 *
 * @param key The key to get a value for
 * @param defaultDouble Default to return if key is not represented
 * @return The <code>double</code> value if key is represented, specified
 * default otherwise
 */
public double getDouble(String key, double defaultDouble) {
  if (!containsKey(key)) {
    return defaultDouble;
  }
  return getDouble(key);
}

代码示例来源:origin: apache/servicemix-bundles

key = key.replace("(double)", "");
if (executionContext.containsKey(key)) {
  builder.addDouble(key, executionContext.getDouble(key));

代码示例来源:origin: org.springframework.batch/org.springframework.batch.core

key = key.replace("(double)", "");
if (executionContext.containsKey(key)) {
  builder.addDouble(key, executionContext.getDouble(key));

代码示例来源:origin: org.springframework.batch/spring-batch-core

key = key.replace("(double)", "");
if (executionContext.containsKey(key)) {
  builder.addDouble(key, executionContext.getDouble(key));

代码示例来源:origin: org.springframework.batch.core/org.motechproject.org.springframework.batch.core

key = key.replace("(double)", "");
if (executionContext.containsKey(key)) {
  builder.addDouble(key, executionContext.getDouble(key));

相关文章