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

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

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

Duration.buildBySeconds介绍

暂无

代码示例

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

  1. public static Duration valueOf(String durationStr) {
  2. Matcher matcher = DURATION_PATTERN.matcher(durationStr);
  3. if (matcher.matches()) {
  4. String doubleStr = matcher.group(DOUBLE_GROUP);
  5. String unitStr = matcher.group(UNIT_GROUP);
  6. double doubleValue = Double.valueOf(doubleStr);
  7. if (unitStr.equalsIgnoreCase("milli")
  8. || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) {
  9. return buildByMilliseconds(doubleValue);
  10. } else if (unitStr.equalsIgnoreCase("second")
  11. || unitStr.equalsIgnoreCase("seconde")) {
  12. return buildBySeconds(doubleValue);
  13. } else if (unitStr.equalsIgnoreCase("minute")) {
  14. return buildByMinutes(doubleValue);
  15. } else if (unitStr.equalsIgnoreCase("hour")) {
  16. return buildByHours(doubleValue);
  17. } else if (unitStr.equalsIgnoreCase("day")) {
  18. return buildByDays(doubleValue);
  19. } else {
  20. throw new IllegalStateException("Unexpected " + unitStr);
  21. }
  22. } else {
  23. throw new IllegalArgumentException("String value [" + durationStr
  24. + "] is not in the expected format.");
  25. }
  26. }

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

  1. public static Duration valueOf(String durationStr) {
  2. Matcher matcher = DURATION_PATTERN.matcher(durationStr);
  3. if (matcher.matches()) {
  4. String doubleStr = matcher.group(DOUBLE_GROUP);
  5. String unitStr = matcher.group(UNIT_GROUP);
  6. double doubleValue = Double.valueOf(doubleStr);
  7. if (unitStr.equalsIgnoreCase("milli")
  8. || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) {
  9. return buildByMilliseconds(doubleValue);
  10. } else if (unitStr.equalsIgnoreCase("second")
  11. || unitStr.equalsIgnoreCase("seconde")) {
  12. return buildBySeconds(doubleValue);
  13. } else if (unitStr.equalsIgnoreCase("minute")) {
  14. return buildByMinutes(doubleValue);
  15. } else if (unitStr.equalsIgnoreCase("hour")) {
  16. return buildByHours(doubleValue);
  17. } else if (unitStr.equalsIgnoreCase("day")) {
  18. return buildByDays(doubleValue);
  19. } else {
  20. throw new IllegalStateException("Unexpected " + unitStr);
  21. }
  22. } else {
  23. throw new IllegalArgumentException("String value [" + durationStr
  24. + "] is not in the expected format.");
  25. }
  26. }

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

  1. public static Duration valueOf(String durationStr) {
  2. Matcher matcher = DURATION_PATTERN.matcher(durationStr);
  3. if (matcher.matches()) {
  4. String doubleStr = matcher.group(DOUBLE_GROUP);
  5. String unitStr = matcher.group(UNIT_GROUP);
  6. double doubleValue = Double.valueOf(doubleStr);
  7. if (unitStr.equalsIgnoreCase("milli") || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) {
  8. return buildByMilliseconds(doubleValue);
  9. } else if (unitStr.equalsIgnoreCase("second") || unitStr.equalsIgnoreCase("seconde")) {
  10. return buildBySeconds(doubleValue);
  11. } else if (unitStr.equalsIgnoreCase("minute")) {
  12. return buildByMinutes(doubleValue);
  13. } else if (unitStr.equalsIgnoreCase("hour")) {
  14. return buildByHours(doubleValue);
  15. } else if (unitStr.equalsIgnoreCase("day")) {
  16. return buildByDays(doubleValue);
  17. } else {
  18. throw new IllegalStateException("Unexpected " + unitStr);
  19. }
  20. } else {
  21. throw new IllegalArgumentException("String value [" + durationStr + "] is not in the expected format.");
  22. }
  23. }

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

  1. public static Duration valueOf(String durationStr) {
  2. Matcher matcher = DURATION_PATTERN.matcher(durationStr);
  3. if (matcher.matches()) {
  4. String doubleStr = matcher.group(DOUBLE_GROUP);
  5. String unitStr = matcher.group(UNIT_GROUP);
  6. double doubleValue = Double.valueOf(doubleStr);
  7. if (unitStr.equalsIgnoreCase("milli") || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) {
  8. return buildByMilliseconds(doubleValue);
  9. } else if (unitStr.equalsIgnoreCase("second") || unitStr.equalsIgnoreCase("seconde")) {
  10. return buildBySeconds(doubleValue);
  11. } else if (unitStr.equalsIgnoreCase("minute")) {
  12. return buildByMinutes(doubleValue);
  13. } else if (unitStr.equalsIgnoreCase("hour")) {
  14. return buildByHours(doubleValue);
  15. } else if (unitStr.equalsIgnoreCase("day")) {
  16. return buildByDays(doubleValue);
  17. } else {
  18. throw new IllegalStateException("Unexpected " + unitStr);
  19. }
  20. } else {
  21. throw new IllegalArgumentException("String value [" + durationStr + "] is not in the expected format.");
  22. }
  23. }

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

  1. public static Duration valueOf(String durationStr) {
  2. Matcher matcher = DURATION_PATTERN.matcher(durationStr);
  3. if (matcher.matches()) {
  4. String doubleStr = matcher.group(DOUBLE_GROUP);
  5. String unitStr = matcher.group(UNIT_GROUP);
  6. double doubleValue = Double.valueOf(doubleStr);
  7. if (unitStr.equalsIgnoreCase("milli") || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) {
  8. return buildByMilliseconds(doubleValue);
  9. } else if (unitStr.equalsIgnoreCase("second") || unitStr.equalsIgnoreCase("seconde")) {
  10. return buildBySeconds(doubleValue);
  11. } else if (unitStr.equalsIgnoreCase("minute")) {
  12. return buildByMinutes(doubleValue);
  13. } else if (unitStr.equalsIgnoreCase("hour")) {
  14. return buildByHours(doubleValue);
  15. } else if (unitStr.equalsIgnoreCase("day")) {
  16. return buildByDays(doubleValue);
  17. } else {
  18. throw new IllegalStateException("Unexpected " + unitStr);
  19. }
  20. } else {
  21. throw new IllegalArgumentException("String value [" + durationStr + "] is not in the expected format.");
  22. }
  23. }

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

  1. public static Duration valueOf(String durationStr) {
  2. Matcher matcher = DURATION_PATTERN.matcher(durationStr);
  3. if (matcher.matches()) {
  4. String doubleStr = matcher.group(DOUBLE_GROUP);
  5. String unitStr = matcher.group(UNIT_GROUP);
  6. double doubleValue = Double.valueOf(doubleStr);
  7. if (unitStr.equalsIgnoreCase("milli")
  8. || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) {
  9. return buildByMilliseconds(doubleValue);
  10. } else if (unitStr.equalsIgnoreCase("second")
  11. || unitStr.equalsIgnoreCase("seconde")) {
  12. return buildBySeconds(doubleValue);
  13. } else if (unitStr.equalsIgnoreCase("minute")) {
  14. return buildByMinutes(doubleValue);
  15. } else if (unitStr.equalsIgnoreCase("hour")) {
  16. return buildByHours(doubleValue);
  17. } else if (unitStr.equalsIgnoreCase("day")) {
  18. return buildByDays(doubleValue);
  19. } else {
  20. throw new IllegalStateException("Unexpected " + unitStr);
  21. }
  22. } else {
  23. throw new IllegalArgumentException("String value [" + durationStr
  24. + "] is not in the expected format.");
  25. }
  26. }

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

  1. public static Duration valueOf(String durationStr) {
  2. Matcher matcher = DURATION_PATTERN.matcher(durationStr);
  3. if (matcher.matches()) {
  4. String doubleStr = matcher.group(DOUBLE_GROUP);
  5. String unitStr = matcher.group(UNIT_GROUP);
  6. double doubleValue = Double.valueOf(doubleStr);
  7. if (unitStr.equalsIgnoreCase("milli")
  8. || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) {
  9. return buildByMilliseconds(doubleValue);
  10. } else if (unitStr.equalsIgnoreCase("second")
  11. || unitStr.equalsIgnoreCase("seconde")) {
  12. return buildBySeconds(doubleValue);
  13. } else if (unitStr.equalsIgnoreCase("minute")) {
  14. return buildByMinutes(doubleValue);
  15. } else if (unitStr.equalsIgnoreCase("hour")) {
  16. return buildByHours(doubleValue);
  17. } else if (unitStr.equalsIgnoreCase("day")) {
  18. return buildByDays(doubleValue);
  19. } else {
  20. throw new IllegalStateException("Unexpected " + unitStr);
  21. }
  22. } else {
  23. throw new IllegalArgumentException("String value [" + durationStr
  24. + "] is not in the expected format.");
  25. }
  26. }

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

  1. public static Duration valueOf(String durationStr) {
  2. Matcher matcher = DURATION_PATTERN.matcher(durationStr);
  3. if (matcher.matches()) {
  4. String doubleStr = matcher.group(DOUBLE_GROUP);
  5. String unitStr = matcher.group(UNIT_GROUP);
  6. double doubleValue = Double.valueOf(doubleStr);
  7. if (unitStr.equalsIgnoreCase("milli")
  8. || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) {
  9. return buildByMilliseconds(doubleValue);
  10. } else if (unitStr.equalsIgnoreCase("second")
  11. || unitStr.equalsIgnoreCase("seconde")) {
  12. return buildBySeconds(doubleValue);
  13. } else if (unitStr.equalsIgnoreCase("minute")) {
  14. return buildByMinutes(doubleValue);
  15. } else if (unitStr.equalsIgnoreCase("hour")) {
  16. return buildByHours(doubleValue);
  17. } else if (unitStr.equalsIgnoreCase("day")) {
  18. return buildByDays(doubleValue);
  19. } else {
  20. throw new IllegalStateException("Unexpected " + unitStr);
  21. }
  22. } else {
  23. throw new IllegalArgumentException("String value [" + durationStr
  24. + "] is not in the expected format.");
  25. }
  26. }

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

  1. public static Duration valueOf(String durationStr) {
  2. Matcher matcher = DURATION_PATTERN.matcher(durationStr);
  3. if (matcher.matches()) {
  4. String doubleStr = matcher.group(DOUBLE_GROUP);
  5. String unitStr = matcher.group(UNIT_GROUP);
  6. double doubleValue = Double.valueOf(doubleStr);
  7. if (unitStr.equalsIgnoreCase("milli")
  8. || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) {
  9. return buildByMilliseconds(doubleValue);
  10. } else if (unitStr.equalsIgnoreCase("second")
  11. || unitStr.equalsIgnoreCase("seconde")) {
  12. return buildBySeconds(doubleValue);
  13. } else if (unitStr.equalsIgnoreCase("minute")) {
  14. return buildByMinutes(doubleValue);
  15. } else if (unitStr.equalsIgnoreCase("hour")) {
  16. return buildByHours(doubleValue);
  17. } else if (unitStr.equalsIgnoreCase("day")) {
  18. return buildByDays(doubleValue);
  19. } else {
  20. throw new IllegalStateException("Unexpected " + unitStr);
  21. }
  22. } else {
  23. throw new IllegalArgumentException("String value [" + durationStr
  24. + "] is not in the expected format.");
  25. }
  26. }

相关文章