aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2014-01-20 03:18:22 +0100
committerRoel Spilker <r.spilker@gmail.com>2014-01-20 03:18:22 +0100
commite8059d4e9e4ada081363978df1ed937c2b782788 (patch)
tree9c75b1d15e3218508db1237d03626c6d323c8ada /src/core/lombok
parent01cee6f22df04c567080a3a439af738600e8e2c2 (diff)
downloadlombok-e8059d4e9e4ada081363978df1ed937c2b782788.tar.gz
lombok-e8059d4e9e4ada081363978df1ed937c2b782788.tar.bz2
lombok-e8059d4e9e4ada081363978df1ed937c2b782788.zip
[configuration] Code cleanup
Diffstat (limited to 'src/core/lombok')
-rw-r--r--src/core/lombok/core/LombokConfiguration.java2
-rw-r--r--src/core/lombok/core/configuration/ConfigurationApp.java2
-rw-r--r--src/core/lombok/core/configuration/ConfigurationKey.java27
-rw-r--r--src/core/lombok/core/configuration/StringConfigurationSource.java2
4 files changed, 7 insertions, 26 deletions
diff --git a/src/core/lombok/core/LombokConfiguration.java b/src/core/lombok/core/LombokConfiguration.java
index 690c05ee..f2661a53 100644
--- a/src/core/lombok/core/LombokConfiguration.java
+++ b/src/core/lombok/core/LombokConfiguration.java
@@ -60,7 +60,7 @@ public class LombokConfiguration {
// create a new empty 'cache' to make sure all problems are reported
cache.reset();
ConfigurationResolver resolver = new BubblingConfigurationResolver(cache.sourcesForJavaFile(ast.getAbsoluteFileLocation(), reporter));
- for (ConfigurationKey<?> key : ConfigurationKey.registeredKeys()) {
+ for (ConfigurationKey<?> key : ConfigurationKey.registeredKeys().values()) {
Object value = resolver.resolve(key);
if (value == null || value instanceof List<?> && ((List<?>)value).isEmpty()) continue;
stream.printf("%s: %s\n", key.getKeyName(), value);
diff --git a/src/core/lombok/core/configuration/ConfigurationApp.java b/src/core/lombok/core/configuration/ConfigurationApp.java
index 183bbf6d..e7f438d7 100644
--- a/src/core/lombok/core/configuration/ConfigurationApp.java
+++ b/src/core/lombok/core/configuration/ConfigurationApp.java
@@ -116,7 +116,7 @@ public class ConfigurationApp extends LombokApp {
}
private void printConfiguration(PrintStream out, boolean verbose) {
- for (ConfigurationKey<?> key : ConfigurationKey.registeredKeys()) {
+ for (ConfigurationKey<?> key : ConfigurationKey.registeredKeys().values()) {
String keyName = key.getKeyName();
ConfigurationDataType type = key.getType();
String description = key.getDescription();
diff --git a/src/core/lombok/core/configuration/ConfigurationKey.java b/src/core/lombok/core/configuration/ConfigurationKey.java
index cfd63eb3..d46a70b0 100644
--- a/src/core/lombok/core/configuration/ConfigurationKey.java
+++ b/src/core/lombok/core/configuration/ConfigurationKey.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 The Project Lombok Authors.
+ * Copyright (C) 2013-2014 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -22,7 +22,6 @@
package lombok.core.configuration;
import java.util.Collections;
-import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
import java.util.regex.Pattern;
@@ -36,7 +35,7 @@ import java.util.regex.Pattern;
* </pre>
*/
public abstract class ConfigurationKey<T> {
- private static final Pattern VALID_NAMES = Pattern.compile("[\\-_a-zA-Z][\\-\\.\\w]*(?<![\\.\\-])");
+ private static final Pattern VALID_NAMES = Pattern.compile("[-_a-zA-Z][-.\\w]*(?<![-.])");
private static final TreeMap<String, ConfigurationKey<?>> registeredKeys = new TreeMap<String, ConfigurationKey<?>>(String.CASE_INSENSITIVE_ORDER);
private static Map<String, ConfigurationKey<?>> copy;
@@ -45,11 +44,6 @@ public abstract class ConfigurationKey<T> {
private final String description;
private final ConfigurationDataType type;
- @Deprecated
- public ConfigurationKey(String keyName) {
- this(keyName, null);
- }
-
public ConfigurationKey(String keyName, String description) {
this.keyName = checkName(keyName);
@SuppressWarnings("unchecked")
@@ -63,7 +57,7 @@ public abstract class ConfigurationKey<T> {
return keyName;
}
- public String getDescription() {
+ public final String getDescription() {
return description;
}
@@ -85,26 +79,13 @@ public abstract class ConfigurationKey<T> {
* Returns a copy of the currently registered keys.
*/
@SuppressWarnings("unchecked")
- public static Map<String, ConfigurationKey<?>> registeredKeysMap() {
+ public static Map<String, ConfigurationKey<?>> registeredKeys() {
synchronized (registeredKeys) {
if (copy == null) copy = Collections.unmodifiableMap((Map<String, ConfigurationKey<?>>) registeredKeys.clone());
return copy;
}
}
-
- /**
- * Returns a copy of the currently registered keys.
- */
- public static Iterable<ConfigurationKey<?>> registeredKeys() {
- final Map<String, ConfigurationKey<?>> map = registeredKeysMap();
- return new Iterable<ConfigurationKey<?>>() {
- @Override public Iterator<ConfigurationKey<?>> iterator() {
- return map.values().iterator();
- }
- };
- }
-
private static void registerKey(String keyName, ConfigurationKey<?> key) {
synchronized (registeredKeys) {
if (registeredKeys.containsKey(keyName)) throw new IllegalArgumentException("Key '" + keyName + "' already registered");
diff --git a/src/core/lombok/core/configuration/StringConfigurationSource.java b/src/core/lombok/core/configuration/StringConfigurationSource.java
index 27887a6e..aad3d0c8 100644
--- a/src/core/lombok/core/configuration/StringConfigurationSource.java
+++ b/src/core/lombok/core/configuration/StringConfigurationSource.java
@@ -42,7 +42,7 @@ public class StringConfigurationSource implements ConfigurationSource {
Map<String, Result> values = new TreeMap<String, Result>(String.CASE_INSENSITIVE_ORDER);
- Map<String, ConfigurationKey<?>> registeredKeys = ConfigurationKey.registeredKeysMap();
+ Map<String, ConfigurationKey<?>> registeredKeys = ConfigurationKey.registeredKeys();
int lineNumber = 0;
Matcher lineMatcher = NEWLINE_FINDER.matcher(content);
while (lineMatcher.find()) {