ch.qos.logback.core.util.Duration.buildByMilliseconds()方法的使用及代码示例

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

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

Duration.buildByMilliseconds介绍

暂无

代码示例

代码示例来源:origin: camunda/camunda-bpm-platform

public static Duration valueOf(String durationStr) {
 Matcher matcher = DURATION_PATTERN.matcher(durationStr);
 if (matcher.matches()) {
  String doubleStr = matcher.group(DOUBLE_GROUP);
  String unitStr = matcher.group(UNIT_GROUP);
  double doubleValue = Double.valueOf(doubleStr);
  if (unitStr.equalsIgnoreCase("milli")
    || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) {
   return buildByMilliseconds(doubleValue);
  } else if (unitStr.equalsIgnoreCase("second")
    || unitStr.equalsIgnoreCase("seconde")) {
   return buildBySeconds(doubleValue);
  } else if (unitStr.equalsIgnoreCase("minute")) {
   return buildByMinutes(doubleValue);
  } else if (unitStr.equalsIgnoreCase("hour")) {
   return buildByHours(doubleValue);
  } else if (unitStr.equalsIgnoreCase("day")) {
   return buildByDays(doubleValue);
  } else {
   throw new IllegalStateException("Unexpected " + unitStr);
  }
 } else {
  throw new IllegalArgumentException("String value [" + durationStr
    + "] is not in the expected format.");
 }
}

代码示例来源:origin: tony19/logback-android

public static Duration valueOf(String durationStr) {
 Matcher matcher = DURATION_PATTERN.matcher(durationStr);
 if (matcher.matches()) {
  String doubleStr = matcher.group(DOUBLE_GROUP);
  String unitStr = matcher.group(UNIT_GROUP);
  double doubleValue = Double.valueOf(doubleStr);
  if (unitStr.equalsIgnoreCase("milli")
    || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) {
   return buildByMilliseconds(doubleValue);
  } else if (unitStr.equalsIgnoreCase("second")
    || unitStr.equalsIgnoreCase("seconde")) {
   return buildBySeconds(doubleValue);
  } else if (unitStr.equalsIgnoreCase("minute")) {
   return buildByMinutes(doubleValue);
  } else if (unitStr.equalsIgnoreCase("hour")) {
   return buildByHours(doubleValue);
  } else if (unitStr.equalsIgnoreCase("day")) {
   return buildByDays(doubleValue);
  } else {
   throw new IllegalStateException("Unexpected " + unitStr);
  }
 } else {
  throw new IllegalArgumentException("String value [" + durationStr
    + "] is not in the expected format.");
 }
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

public static Duration valueOf(String durationStr) {
  Matcher matcher = DURATION_PATTERN.matcher(durationStr);
  if (matcher.matches()) {
    String doubleStr = matcher.group(DOUBLE_GROUP);
    String unitStr = matcher.group(UNIT_GROUP);
    double doubleValue = Double.valueOf(doubleStr);
    if (unitStr.equalsIgnoreCase("milli") || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) {
      return buildByMilliseconds(doubleValue);
    } else if (unitStr.equalsIgnoreCase("second") || unitStr.equalsIgnoreCase("seconde")) {
      return buildBySeconds(doubleValue);
    } else if (unitStr.equalsIgnoreCase("minute")) {
      return buildByMinutes(doubleValue);
    } else if (unitStr.equalsIgnoreCase("hour")) {
      return buildByHours(doubleValue);
    } else if (unitStr.equalsIgnoreCase("day")) {
      return buildByDays(doubleValue);
    } else {
      throw new IllegalStateException("Unexpected " + unitStr);
    }
  } else {
    throw new IllegalArgumentException("String value [" + durationStr + "] is not in the expected format.");
  }
}

代码示例来源:origin: Nextdoor/bender

public static Duration valueOf(String durationStr) {
  Matcher matcher = DURATION_PATTERN.matcher(durationStr);
  if (matcher.matches()) {
    String doubleStr = matcher.group(DOUBLE_GROUP);
    String unitStr = matcher.group(UNIT_GROUP);
    double doubleValue = Double.valueOf(doubleStr);
    if (unitStr.equalsIgnoreCase("milli") || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) {
      return buildByMilliseconds(doubleValue);
    } else if (unitStr.equalsIgnoreCase("second") || unitStr.equalsIgnoreCase("seconde")) {
      return buildBySeconds(doubleValue);
    } else if (unitStr.equalsIgnoreCase("minute")) {
      return buildByMinutes(doubleValue);
    } else if (unitStr.equalsIgnoreCase("hour")) {
      return buildByHours(doubleValue);
    } else if (unitStr.equalsIgnoreCase("day")) {
      return buildByDays(doubleValue);
    } else {
      throw new IllegalStateException("Unexpected " + unitStr);
    }
  } else {
    throw new IllegalArgumentException("String value [" + durationStr + "] is not in the expected format.");
  }
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

public static Duration valueOf(String durationStr) {
  Matcher matcher = DURATION_PATTERN.matcher(durationStr);
  if (matcher.matches()) {
    String doubleStr = matcher.group(DOUBLE_GROUP);
    String unitStr = matcher.group(UNIT_GROUP);
    double doubleValue = Double.valueOf(doubleStr);
    if (unitStr.equalsIgnoreCase("milli") || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) {
      return buildByMilliseconds(doubleValue);
    } else if (unitStr.equalsIgnoreCase("second") || unitStr.equalsIgnoreCase("seconde")) {
      return buildBySeconds(doubleValue);
    } else if (unitStr.equalsIgnoreCase("minute")) {
      return buildByMinutes(doubleValue);
    } else if (unitStr.equalsIgnoreCase("hour")) {
      return buildByHours(doubleValue);
    } else if (unitStr.equalsIgnoreCase("day")) {
      return buildByDays(doubleValue);
    } else {
      throw new IllegalStateException("Unexpected " + unitStr);
    }
  } else {
    throw new IllegalArgumentException("String value [" + durationStr + "] is not in the expected format.");
  }
}

代码示例来源:origin: ch.qos.logback/core

public static Duration valueOf(String durationStr) {
 Matcher matcher = DURATION_PATTERN.matcher(durationStr);
 if (matcher.matches()) {
  String doubleStr = matcher.group(DOUBLE_GROUP);
  String unitStr = matcher.group(UNIT_GROUP);
  double doubleValue = Double.valueOf(doubleStr);
  if (unitStr.equalsIgnoreCase("milli")
    || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) {
   return buildByMilliseconds(doubleValue);
  } else if (unitStr.equalsIgnoreCase("second")
    || unitStr.equalsIgnoreCase("seconde")) {
   return buildBySeconds(doubleValue);
  } else if (unitStr.equalsIgnoreCase("minute")) {
   return buildByMinutes(doubleValue);
  } else if (unitStr.equalsIgnoreCase("hour")) {
   return buildByHours(doubleValue);
  } else if (unitStr.equalsIgnoreCase("day")) {
   return buildByDays(doubleValue);
  } else {
   throw new IllegalStateException("Unexpected " + unitStr);
  }
 } else {
  throw new IllegalArgumentException("String value [" + durationStr
    + "] is not in the expected format.");
 }
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/ch.qos.logback.core

public static Duration valueOf(String durationStr) {
 Matcher matcher = DURATION_PATTERN.matcher(durationStr);
 if (matcher.matches()) {
  String doubleStr = matcher.group(DOUBLE_GROUP);
  String unitStr = matcher.group(UNIT_GROUP);
  double doubleValue = Double.valueOf(doubleStr);
  if (unitStr.equalsIgnoreCase("milli")
    || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) {
   return buildByMilliseconds(doubleValue);
  } else if (unitStr.equalsIgnoreCase("second")
    || unitStr.equalsIgnoreCase("seconde")) {
   return buildBySeconds(doubleValue);
  } else if (unitStr.equalsIgnoreCase("minute")) {
   return buildByMinutes(doubleValue);
  } else if (unitStr.equalsIgnoreCase("hour")) {
   return buildByHours(doubleValue);
  } else if (unitStr.equalsIgnoreCase("day")) {
   return buildByDays(doubleValue);
  } else {
   throw new IllegalStateException("Unexpected " + unitStr);
  }
 } else {
  throw new IllegalArgumentException("String value [" + durationStr
    + "] is not in the expected format.");
 }
}

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

public static Duration valueOf(String durationStr) {
 Matcher matcher = DURATION_PATTERN.matcher(durationStr);
 if (matcher.matches()) {
  String doubleStr = matcher.group(DOUBLE_GROUP);
  String unitStr = matcher.group(UNIT_GROUP);
  double doubleValue = Double.valueOf(doubleStr);
  if (unitStr.equalsIgnoreCase("milli")
    || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) {
   return buildByMilliseconds(doubleValue);
  } else if (unitStr.equalsIgnoreCase("second")
    || unitStr.equalsIgnoreCase("seconde")) {
   return buildBySeconds(doubleValue);
  } else if (unitStr.equalsIgnoreCase("minute")) {
   return buildByMinutes(doubleValue);
  } else if (unitStr.equalsIgnoreCase("hour")) {
   return buildByHours(doubleValue);
  } else if (unitStr.equalsIgnoreCase("day")) {
   return buildByDays(doubleValue);
  } else {
   throw new IllegalStateException("Unexpected " + unitStr);
  }
 } else {
  throw new IllegalArgumentException("String value [" + durationStr
    + "] is not in the expected format.");
 }
}

代码示例来源:origin: com.hynnet/logback-core

public static Duration valueOf(String durationStr) {
 Matcher matcher = DURATION_PATTERN.matcher(durationStr);
 if (matcher.matches()) {
  String doubleStr = matcher.group(DOUBLE_GROUP);
  String unitStr = matcher.group(UNIT_GROUP);
  double doubleValue = Double.valueOf(doubleStr);
  if (unitStr.equalsIgnoreCase("milli")
    || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) {
   return buildByMilliseconds(doubleValue);
  } else if (unitStr.equalsIgnoreCase("second")
    || unitStr.equalsIgnoreCase("seconde")) {
   return buildBySeconds(doubleValue);
  } else if (unitStr.equalsIgnoreCase("minute")) {
   return buildByMinutes(doubleValue);
  } else if (unitStr.equalsIgnoreCase("hour")) {
   return buildByHours(doubleValue);
  } else if (unitStr.equalsIgnoreCase("day")) {
   return buildByDays(doubleValue);
  } else {
   throw new IllegalStateException("Unexpected " + unitStr);
  }
 } else {
  throw new IllegalArgumentException("String value [" + durationStr
    + "] is not in the expected format.");
 }
}

相关文章