mirror of
https://github.com/lightbend/config.git
synced 2025-01-29 05:30:08 +08:00
Remove some dead code
This commit is contained in:
parent
1afaea55a8
commit
597452cac0
@ -282,19 +282,4 @@ final class ConfigConcatenation extends AbstractConfigValue implements Unmergeab
|
|||||||
p.render(sb, indent, atRoot, options);
|
p.render(sb, indent, atRoot, options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<AbstractConfigValue> valuesFromPieces(ConfigOrigin origin, List<Object> pieces) {
|
|
||||||
List<AbstractConfigValue> values = new ArrayList<AbstractConfigValue>(pieces.size());
|
|
||||||
for (Object p : pieces) {
|
|
||||||
if (p instanceof SubstitutionExpression) {
|
|
||||||
values.add(new ConfigReference(origin, (SubstitutionExpression) p));
|
|
||||||
} else if (p instanceof String) {
|
|
||||||
values.add(new ConfigString(origin, (String) p));
|
|
||||||
} else {
|
|
||||||
throw new ConfigException.BugOrBroken("Unexpected piece " + p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return values;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
package com.typesafe.config.impl;
|
package com.typesafe.config.impl;
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.NoSuchElementException;
|
|
||||||
|
|
||||||
import com.typesafe.config.ConfigException;
|
import com.typesafe.config.ConfigException;
|
||||||
import com.typesafe.config.impl.AbstractConfigValue.NotPossibleToResolve;
|
import com.typesafe.config.impl.AbstractConfigValue.NotPossibleToResolve;
|
||||||
|
|
||||||
@ -161,19 +158,6 @@ final class ResolveSource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ResolveSource popParent(Container parent) {
|
|
||||||
if (ConfigImpl.traceSubstitutionsEnabled())
|
|
||||||
ConfigImpl.trace("popping parent " + parent);
|
|
||||||
if (parent == null)
|
|
||||||
throw new ConfigException.BugOrBroken("can't pop null parent");
|
|
||||||
else if (pathFromRoot == null)
|
|
||||||
return this;
|
|
||||||
else if (pathFromRoot.head() != parent)
|
|
||||||
throw new ConfigException.BugOrBroken("parent was not pushed, can't pop: " + parent);
|
|
||||||
else
|
|
||||||
return new ResolveSource(root, pathFromRoot.tail());
|
|
||||||
}
|
|
||||||
|
|
||||||
ResolveSource resetParents() {
|
ResolveSource resetParents() {
|
||||||
if (pathFromRoot == null)
|
if (pathFromRoot == null)
|
||||||
return this;
|
return this;
|
||||||
@ -271,27 +255,10 @@ final class ResolveSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// a persistent list
|
// a persistent list
|
||||||
static final class Node<T> implements Iterable<T> {
|
static final class Node<T> {
|
||||||
final T value;
|
final T value;
|
||||||
final Node<T> next;
|
final Node<T> next;
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return value.hashCode() + 41 * (41 + next.hashCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object other) {
|
|
||||||
if (other instanceof Node<?>) {
|
|
||||||
if (value == ((Node<?>) other).value)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return value.equals(((Node<?>) other).value);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Node(T value, Node<T> next) {
|
Node(T value, Node<T> next) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.next = next;
|
this.next = next;
|
||||||
@ -334,40 +301,6 @@ final class ResolveSource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class NodeIterator<T> implements Iterator<T> {
|
|
||||||
Node<T> current;
|
|
||||||
|
|
||||||
NodeIterator(Node<T> current) {
|
|
||||||
this.current = current;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public T next() {
|
|
||||||
if (current == null) {
|
|
||||||
throw new NoSuchElementException();
|
|
||||||
} else {
|
|
||||||
T result = current.value;
|
|
||||||
current = current.next;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasNext() {
|
|
||||||
return current != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void remove() {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterator<T> iterator() {
|
|
||||||
return new NodeIterator<T>(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
@ -394,17 +327,6 @@ final class ResolveSource {
|
|||||||
this.pathFromRoot = pathFromRoot;
|
this.pathFromRoot = pathFromRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
ValueWithPath(AbstractConfigValue value) {
|
|
||||||
this(value, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
ValueWithPath addParent(Container parent) {
|
|
||||||
if (pathFromRoot == null)
|
|
||||||
return new ValueWithPath(value, new Node<Container>(parent));
|
|
||||||
else
|
|
||||||
return new ValueWithPath(value, pathFromRoot.prepend(parent));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ValueWithPath(value=" + value + ", pathFromRoot=" + pathFromRoot + ")";
|
return "ValueWithPath(value=" + value + ", pathFromRoot=" + pathFromRoot + ")";
|
||||||
@ -420,17 +342,6 @@ final class ResolveSource {
|
|||||||
this.pathFromRoot = pathFromRoot;
|
this.pathFromRoot = pathFromRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultWithPath(ResolveResult<? extends AbstractConfigValue> result) {
|
|
||||||
this(result, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
ResultWithPath addParent(Container parent) {
|
|
||||||
if (pathFromRoot == null)
|
|
||||||
return new ResultWithPath(result, new Node<Container>(parent));
|
|
||||||
else
|
|
||||||
return new ResultWithPath(result, pathFromRoot.prepend(parent));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ResultWithPath(result=" + result + ", pathFromRoot=" + pathFromRoot + ")";
|
return "ResultWithPath(result=" + result + ", pathFromRoot=" + pathFromRoot + ")";
|
||||||
|
Loading…
Reference in New Issue
Block a user