95 lines
4.6 KiB
Java
95 lines
4.6 KiB
Java
package lombok.core.configuration;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import lombok.core.configuration.ConfigurationParser;
|
|
import lombok.core.configuration.ConfigurationSource;
|
|
/* loaded from: com.discord-117014.apk:lombok/core/configuration/SingleConfigurationSource.SCL.lombok */
|
|
public final class SingleConfigurationSource implements ConfigurationSource {
|
|
private final Map<ConfigurationKey<?>, ConfigurationSource.Result> values = new HashMap();
|
|
private final List<ConfigurationFile> imports;
|
|
|
|
/* renamed from: lombok.core.configuration.SingleConfigurationSource$1 reason: invalid class name */
|
|
/* loaded from: com.discord-117014.apk:lombok/core/configuration/SingleConfigurationSource$1.SCL.lombok */
|
|
class AnonymousClass1 implements ConfigurationParser.Collector {
|
|
private final /* synthetic */ List val$imports;
|
|
private final /* synthetic */ Map val$values;
|
|
|
|
AnonymousClass1(List list, Map map) {
|
|
this.val$imports = list;
|
|
this.val$values = map;
|
|
}
|
|
|
|
@Override // lombok.core.configuration.ConfigurationParser.Collector
|
|
public void addImport(ConfigurationFile configurationFile, ConfigurationFile configurationFile2, int i) {
|
|
this.val$imports.add(configurationFile);
|
|
}
|
|
|
|
@Override // lombok.core.configuration.ConfigurationParser.Collector
|
|
public void clear(ConfigurationKey<?> configurationKey, ConfigurationFile configurationFile, int i) {
|
|
this.val$values.put(configurationKey, new ConfigurationSource.Result(null, true));
|
|
}
|
|
|
|
@Override // lombok.core.configuration.ConfigurationParser.Collector
|
|
public void set(ConfigurationKey<?> configurationKey, Object obj, ConfigurationFile configurationFile, int i) {
|
|
this.val$values.put(configurationKey, new ConfigurationSource.Result(obj, true));
|
|
}
|
|
|
|
@Override // lombok.core.configuration.ConfigurationParser.Collector
|
|
public void add(ConfigurationKey<?> configurationKey, Object obj, ConfigurationFile configurationFile, int i) {
|
|
modifyList(configurationKey, obj, true);
|
|
}
|
|
|
|
@Override // lombok.core.configuration.ConfigurationParser.Collector
|
|
public void remove(ConfigurationKey<?> configurationKey, Object obj, ConfigurationFile configurationFile, int i) {
|
|
modifyList(configurationKey, obj, false);
|
|
}
|
|
|
|
private void modifyList(ConfigurationKey<?> configurationKey, Object obj, boolean z2) {
|
|
List list;
|
|
ConfigurationSource.Result result = (ConfigurationSource.Result) this.val$values.get(configurationKey);
|
|
if (result == null || result.getValue() == null) {
|
|
list = new ArrayList();
|
|
this.val$values.put(configurationKey, new ConfigurationSource.Result(list, result != null));
|
|
} else {
|
|
list = (List) result.getValue();
|
|
}
|
|
list.add(new ConfigurationSource.ListModification(obj, z2));
|
|
}
|
|
}
|
|
|
|
public static ConfigurationSource parse(ConfigurationFile configurationFile, ConfigurationParser configurationParser) {
|
|
HashMap hashMap = new HashMap();
|
|
ArrayList arrayList = new ArrayList();
|
|
configurationParser.parse(configurationFile, new AnonymousClass1(arrayList, hashMap));
|
|
return new SingleConfigurationSource(hashMap, arrayList);
|
|
}
|
|
|
|
private SingleConfigurationSource(Map<ConfigurationKey<?>, ConfigurationSource.Result> map, List<ConfigurationFile> list) {
|
|
Iterator<Map.Entry<ConfigurationKey<?>, ConfigurationSource.Result>> it = map.entrySet().iterator();
|
|
while (it.hasNext()) {
|
|
Map.Entry<ConfigurationKey<?>, ConfigurationSource.Result> next = it.next();
|
|
ConfigurationSource.Result value = next.getValue();
|
|
if (value.getValue() instanceof List) {
|
|
this.values.put(next.getKey(), new ConfigurationSource.Result(Collections.unmodifiableList((List) value.getValue()), value.isAuthoritative()));
|
|
} else {
|
|
this.values.put(next.getKey(), value);
|
|
}
|
|
}
|
|
this.imports = Collections.unmodifiableList(list);
|
|
}
|
|
|
|
@Override // lombok.core.configuration.ConfigurationSource
|
|
public ConfigurationSource.Result resolve(ConfigurationKey<?> configurationKey) {
|
|
return this.values.get(configurationKey);
|
|
}
|
|
|
|
@Override // lombok.core.configuration.ConfigurationSource
|
|
public List<ConfigurationFile> imports() {
|
|
return this.imports;
|
|
}
|
|
}
|