Skip to content

Commit

Permalink
4.x: Remove unused private static classes from io.helidon.config.Buil…
Browse files Browse the repository at this point in the history
…derImpl
  • Loading branch information
Captain1653 authored and romain-grecourt committed Sep 4, 2024
1 parent a548209 commit 69c0d6b
Showing 1 changed file with 1 addition and 51 deletions.
52 changes: 1 addition & 51 deletions config/config/src/main/java/io/helidon/config/BuilderImpl.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023 Oracle and/or its affiliates.
* Copyright (c) 2017, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -702,56 +702,6 @@ public String toString() {
}
}

private static final class WeightedConfigSource implements Weighted {
private final HelidonSourceWithPriority source;
private final ConfigContext context;

private WeightedConfigSource(HelidonSourceWithPriority source, ConfigContext context) {
this.source = source;
this.context = context;
}

@Override
public double weight() {
return source.weight(context);
}

private ConfigSourceRuntimeImpl runtime(ConfigContextImpl context) {
return context.sourceRuntimeBase(source.unwrap());
}
}

private static final class HelidonSourceWithPriority {
private final ConfigSource configSource;
private final Double explicitWeight;

private HelidonSourceWithPriority(ConfigSource configSource, Double explicitWeight) {
this.configSource = configSource;
this.explicitWeight = explicitWeight;
}

ConfigSource unwrap() {
return configSource;
}

double weight(ConfigContext context) {
// first - explicit priority. If configured by user, return it
if (null != explicitWeight) {
return explicitWeight;
}

// ordinal from data
return context.sourceRuntime(configSource)
.node("config_priority")
.flatMap(node -> node.value()
.map(Double::parseDouble))
.orElseGet(() -> {
// the config source does not have an ordinal configured, I need to get it from other places
return Weights.find(configSource, Weighted.DEFAULT_WEIGHT);
});
}
}

private static class LoadedFilterProvider implements Function<Config, ConfigFilter> {
private final ConfigFilter filter;

Expand Down

0 comments on commit 69c0d6b

Please sign in to comment.