2022-03-01 22:12:19 +00:00
|
|
|
package lombok.core.configuration;
|
|
|
|
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.TreeMap;
|
|
|
|
import java.util.regex.Pattern;
|
2022-03-08 19:25:03 +00:00
|
|
|
/* loaded from: com.discord-118106.apk:lombok/core/configuration/ConfigurationKey.SCL.lombok */
|
2022-03-01 22:12:19 +00:00
|
|
|
public abstract class ConfigurationKey<T> {
|
|
|
|
private static final Pattern VALID_NAMES = Pattern.compile("[-_a-zA-Z][-.\\w]*(?<![-.])");
|
|
|
|
private static final TreeMap<String, ConfigurationKey<?>> registeredKeys = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
|
|
|
private static Map<String, ConfigurationKey<?>> copy;
|
|
|
|
private final String keyName;
|
|
|
|
private final String description;
|
|
|
|
private final ConfigurationDataType type;
|
|
|
|
private final boolean hidden;
|
|
|
|
|
|
|
|
public ConfigurationKey(String str, String str2) {
|
|
|
|
this(str, str2, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConfigurationKey(String str, String str2, boolean z2) {
|
|
|
|
this.keyName = checkName(str);
|
|
|
|
this.type = ConfigurationDataType.toDataType(getClass());
|
|
|
|
this.description = str2;
|
|
|
|
this.hidden = z2;
|
|
|
|
registerKey(str, this);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final String getKeyName() {
|
|
|
|
return this.keyName;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final String getDescription() {
|
|
|
|
return this.description;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final ConfigurationDataType getType() {
|
|
|
|
return this.type;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final boolean isHidden() {
|
|
|
|
return this.hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
return String.valueOf(this.keyName) + " (" + this.type + "): " + this.description;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static String checkName(String str) {
|
|
|
|
if (str == null) {
|
|
|
|
throw new NullPointerException("keyName");
|
|
|
|
} else if (VALID_NAMES.matcher(str).matches()) {
|
|
|
|
return str;
|
|
|
|
} else {
|
|
|
|
throw new IllegalArgumentException("Invalid keyName: " + str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
|
|
/* JADX WARN: Unknown variable types count: 1 */
|
|
|
|
/*
|
|
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
|
|
*/
|
|
|
|
public static Map<String, ConfigurationKey<?>> registeredKeys() {
|
|
|
|
?? r0 = registeredKeys;
|
|
|
|
synchronized (r0) {
|
|
|
|
if (copy == null) {
|
|
|
|
copy = Collections.unmodifiableMap((Map) registeredKeys.clone());
|
|
|
|
}
|
|
|
|
r0 = copy;
|
|
|
|
}
|
|
|
|
return r0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX WARN: Unknown variable types count: 1 */
|
|
|
|
/*
|
|
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
|
|
*/
|
|
|
|
private static void registerKey(String str, ConfigurationKey<?> configurationKey) {
|
|
|
|
synchronized (registeredKeys) {
|
|
|
|
if (registeredKeys.containsKey(str)) {
|
|
|
|
throw new IllegalArgumentException("Key '" + str + "' already registered");
|
|
|
|
}
|
|
|
|
registeredKeys.put(str, configurationKey);
|
|
|
|
copy = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|