From 3cca3e018b8867c960d83717af779c119870a316 Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Fri, 17 Jan 2014 21:50:55 +0100 Subject: [configuration] Removed type parameter from ConfigurationSource.Result --- .../BubblingConfigurationResolver.java | 6 ++--- .../core/configuration/ConfigurationSource.java | 10 ++++---- .../configuration/StringConfigurationSource.java | 27 +++++++++++----------- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/core/lombok/core/configuration/BubblingConfigurationResolver.java b/src/core/lombok/core/configuration/BubblingConfigurationResolver.java index 440d7b68..2e7a76dc 100644 --- a/src/core/lombok/core/configuration/BubblingConfigurationResolver.java +++ b/src/core/lombok/core/configuration/BubblingConfigurationResolver.java @@ -44,7 +44,7 @@ public class BubblingConfigurationResolver implements ConfigurationResolver { boolean isList = key.getType().isList(); List listModifications = null; for (ConfigurationSource source : sources) { - Result result = source.resolve(key); + Result result = source.resolve(key); if (result == null) continue; if (isList) { if (listModifications == null) { @@ -57,9 +57,9 @@ public class BubblingConfigurationResolver implements ConfigurationResolver { if (isList) { break; } - return result.getValue(); + return (T) result.getValue(); } - Result stop = source.resolve(STOP_BUBBLING); + Result stop = source.resolve(STOP_BUBBLING); if (stop != null && Boolean.TRUE.equals(stop.getValue())) break; } if (!isList) { diff --git a/src/core/lombok/core/configuration/ConfigurationSource.java b/src/core/lombok/core/configuration/ConfigurationSource.java index 03c73674..4a2b5808 100644 --- a/src/core/lombok/core/configuration/ConfigurationSource.java +++ b/src/core/lombok/core/configuration/ConfigurationSource.java @@ -23,18 +23,18 @@ package lombok.core.configuration; public interface ConfigurationSource { - Result resolve(ConfigurationKey key); + Result resolve(ConfigurationKey key); - public static final class Result { - private final T value; + public static final class Result { + private final Object value; private final boolean authoritative; - public Result(T value, boolean authoritative) { + public Result(Object value, boolean authoritative) { this.value = value; this.authoritative = authoritative; } - public T getValue() { + public Object getValue() { return value; } diff --git a/src/core/lombok/core/configuration/StringConfigurationSource.java b/src/core/lombok/core/configuration/StringConfigurationSource.java index da01b6ee..d4de8ae1 100644 --- a/src/core/lombok/core/configuration/StringConfigurationSource.java +++ b/src/core/lombok/core/configuration/StringConfigurationSource.java @@ -34,12 +34,12 @@ public class StringConfigurationSource implements ConfigurationSource { private static final Pattern LINE = Pattern.compile("(?:clear\\s+([^=]+))|(?:(\\S*?)\\s*([-+]?=)\\s*(.*?))"); - private final Map> values; + private final Map values; public static ConfigurationSource forString(String content, ConfigurationErrorReporter reporter) { if (reporter == null) throw new NullPointerException("reporter"); - Map> values = new TreeMap>(String.CASE_INSENSITIVE_ORDER); + Map values = new TreeMap(String.CASE_INSENSITIVE_ORDER); Map registeredKeys = ConfigurationKey.registeredKeysAsMap(); int lineNumber = 0; @@ -84,19 +84,19 @@ public class StringConfigurationSource implements ConfigurationSource { return new StringConfigurationSource(values); } - private StringConfigurationSource(Map> values) { - this.values = new TreeMap>(String.CASE_INSENSITIVE_ORDER); - for (Entry> entry : values.entrySet()) { - Result result = entry.getValue(); + private StringConfigurationSource(Map values) { + this.values = new TreeMap(String.CASE_INSENSITIVE_ORDER); + for (Entry entry : values.entrySet()) { + Result result = entry.getValue(); if (result.getValue() instanceof List) { - this.values.put(entry.getKey(), new Result>(Collections.unmodifiableList((List) result.getValue()), result.isAuthoritative())); + this.values.put(entry.getKey(), new Result(Collections.unmodifiableList((List) result.getValue()), result.isAuthoritative())); } else { this.values.put(entry.getKey(), result); } } } - private static void processResult(Map> values, String keyName, String operator, String value, ConfigurationDataType type, ConfigurationErrorReporter reporter, int lineNumber, String line) { + private static void processResult(Map values, String keyName, String operator, String value, ConfigurationDataType type, ConfigurationErrorReporter reporter, int lineNumber, String line) { Object element = null; if (value != null) try { element = type.getParser().parse(value); @@ -109,19 +109,18 @@ public class StringConfigurationSource implements ConfigurationSource { if (element == null && type.isList()) { element = new ArrayList(); } - values.put(keyName, new Result(element, true)); + values.put(keyName, new Result(element, true)); } else { - Result result = values.get(keyName); + Result result = values.get(keyName); @SuppressWarnings("unchecked") List list = result == null ? new ArrayList() : (List) result.getValue(); - if (result == null) values.put(keyName, new Result(list, false)); + if (result == null) values.put(keyName, new Result(list, false)); list.add(new ListModification(element, operator.equals("+="))); } } - @SuppressWarnings("unchecked") @Override - public Result resolve(ConfigurationKey key) { - return (Result) values.get(key.getKeyName()); + public Result resolve(ConfigurationKey key) { + return values.get(key.getKeyName()); } } -- cgit