remove unused StackConfigObject and RawValueType

This commit is contained in:
Havoc Pennington 2011-11-09 11:11:24 -05:00
parent 58b19f5fa4
commit 0ec572c8d9
2 changed files with 0 additions and 103 deletions

View File

@ -1,27 +0,0 @@
package com.typesafe.config.impl;
import com.typesafe.config.ConfigValueType;
enum RawValueType {
OBJECT(ConfigValueType.OBJECT),
LIST(ConfigValueType.LIST),
NUMBER(ConfigValueType.NUMBER),
BOOLEAN(ConfigValueType.BOOLEAN),
NULL(ConfigValueType.NULL),
STRING(ConfigValueType.STRING),
SUBSTITUTION(null),
INCLUDE(null);
ConfigValueType cooked;
RawValueType(ConfigValueType cooked) {
this.cooked = cooked;
}
}

View File

@ -1,76 +0,0 @@
package com.typesafe.config.impl;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.typesafe.config.ConfigOrigin;
/**
* This is unused for now, decided that it was too annoying to "lazy merge" and
* better to do the full merge up-front.
*/
final class StackConfigObject extends AbstractConfigObject {
private List<AbstractConfigObject> stack;
/**
* The stack is ordered from highest to lowest priority. So the start of the
* list is the top of the search path.
*/
StackConfigObject(ConfigOrigin origin, ConfigTransformer transformer,
List<AbstractConfigObject> stack) {
super(origin, transformer);
this.stack = stack;
}
@Override
public boolean containsKey(String key) {
for (AbstractConfigObject o : stack) {
if (o.containsKey(key))
return true;
}
return false;
}
@Override
public Set<String> keySet() {
if (stack.isEmpty()) {
return Collections.emptySet();
} else if (stack.size() == 1) {
return stack.get(0).keySet();
} else {
Set<String> combined = new HashSet<String>();
for (AbstractConfigObject o : stack) {
combined.addAll(o.keySet());
}
return combined;
}
}
@Override
public Object unwrapped() {
Map<String, Object> m = new HashMap<String, Object>();
for (AbstractConfigObject o : stack) {
for (String k : o.keySet()) {
m.put(k, o.peek(k).unwrapped());
}
}
return m;
}
@Override
protected AbstractConfigValue peek(String key) {
for (AbstractConfigObject o : stack) {
// Important: A ConfigNull value would override
// and keep us from returning a later non-null value.
AbstractConfigValue v = o.peek(key);
if (v != null)
return v;
}
return null;
}
}