From 6709f4e99b0c9e0ac2872c3c5fb5a9a15e2a6e77 Mon Sep 17 00:00:00 2001 From: Albertus82 Date: Fri, 1 May 2015 15:04:14 +0200 Subject: [PATCH] Refactoring. --- src/it/albertus/router/RouterLogger.java | 2 +- src/it/albertus/router/Threshold.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/it/albertus/router/RouterLogger.java b/src/it/albertus/router/RouterLogger.java index dbe0e36c..fdd9bf3b 100644 --- a/src/it/albertus/router/RouterLogger.java +++ b/src/it/albertus/router/RouterLogger.java @@ -159,7 +159,7 @@ private void loadThresholds() { continue; } final String thresholdKey = configuration.getProperty(THRESHOLD_PREFIX + '.' + thresholdName + '.' + THRESHOLD_SUFFIX_KEY); - final Type thresholdType = Type.findByName(configuration.getProperty(THRESHOLD_PREFIX + '.' + thresholdName + '.' + THRESHOLD_SUFFIX_TYPE)); + final Type thresholdType = Type.getEnum(configuration.getProperty(THRESHOLD_PREFIX + '.' + thresholdName + '.' + THRESHOLD_SUFFIX_TYPE)); final String thresholdValue = configuration.getProperty(THRESHOLD_PREFIX + '.' + thresholdName + '.' + THRESHOLD_SUFFIX_VALUE); if (thresholdKey == null || "".equals(thresholdKey) || thresholdValue == null || thresholdType == null) { throw new IllegalArgumentException("Threshold misconfigured: \"" + thresholdName + "\"."); diff --git a/src/it/albertus/router/Threshold.java b/src/it/albertus/router/Threshold.java index d9757a0e..a381d3b0 100644 --- a/src/it/albertus/router/Threshold.java +++ b/src/it/albertus/router/Threshold.java @@ -35,10 +35,10 @@ public String toString() { return description; } - public static Type findByName(String name) { - if (name != null) { + public static Type getEnum(String abbreviation) { + if (abbreviation != null) { for (Type type : Type.values()) { - if (type.name().equalsIgnoreCase(name.trim()) || type.abbreviations.contains(name.trim().toLowerCase())) { + if (type.name().equalsIgnoreCase(abbreviation.trim()) || type.abbreviations.contains(abbreviation.trim().toLowerCase())) { return type; } }