mirror of
https://github.com/lightbend/config.git
synced 2025-03-19 13:50:40 +08:00
rename Unresolved to Unmergeable
This commit is contained in:
parent
9cf7b4d65a
commit
10babb5e8c
@ -189,10 +189,10 @@ abstract class AbstractConfigObject extends AbstractConfigValue implements
|
||||
|
||||
@Override
|
||||
public AbstractConfigObject withFallback(ConfigValue other) {
|
||||
if (other instanceof Unresolved) {
|
||||
if (other instanceof Unmergeable) {
|
||||
List<AbstractConfigValue> stack = new ArrayList<AbstractConfigValue>();
|
||||
stack.add(this);
|
||||
stack.addAll(((Unresolved) other).unmergedValues());
|
||||
stack.addAll(((Unmergeable) other).unmergedValues());
|
||||
return new ConfigDelayedMergeObject(mergeOrigins(stack), stack);
|
||||
} else if (other instanceof AbstractConfigObject) {
|
||||
AbstractConfigObject fallback = (AbstractConfigObject) other;
|
||||
|
@ -18,7 +18,7 @@ import com.typesafe.config.ConfigValueType;
|
||||
* substitutions.
|
||||
*/
|
||||
final class ConfigDelayedMerge extends AbstractConfigValue implements
|
||||
Unresolved {
|
||||
Unmergeable {
|
||||
|
||||
// earlier items in the stack win
|
||||
final private List<AbstractConfigValue> stack;
|
||||
@ -88,13 +88,13 @@ final class ConfigDelayedMerge extends AbstractConfigValue implements
|
||||
@Override
|
||||
public AbstractConfigValue withFallback(ConfigValue other) {
|
||||
if (other instanceof AbstractConfigObject
|
||||
|| other instanceof Unresolved) {
|
||||
|| other instanceof Unmergeable) {
|
||||
// if we turn out to be an object, and the fallback also does,
|
||||
// then a merge may be required; delay until we resolve.
|
||||
List<AbstractConfigValue> newStack = new ArrayList<AbstractConfigValue>();
|
||||
newStack.addAll(stack);
|
||||
if (other instanceof Unresolved)
|
||||
newStack.addAll(((Unresolved) other).unmergedValues());
|
||||
if (other instanceof Unmergeable)
|
||||
newStack.addAll(((Unmergeable) other).unmergedValues());
|
||||
else
|
||||
newStack.add((AbstractConfigValue) other);
|
||||
return new ConfigDelayedMerge(
|
||||
|
@ -14,7 +14,7 @@ import com.typesafe.config.ConfigValue;
|
||||
// This is just like ConfigDelayedMerge except we know statically
|
||||
// that it will turn out to be an object.
|
||||
class ConfigDelayedMergeObject extends AbstractConfigObject implements
|
||||
Unresolved {
|
||||
Unmergeable {
|
||||
|
||||
final private List<AbstractConfigValue> stack;
|
||||
|
||||
@ -85,13 +85,13 @@ class ConfigDelayedMergeObject extends AbstractConfigObject implements
|
||||
@Override
|
||||
public ConfigDelayedMergeObject withFallback(ConfigValue other) {
|
||||
if (other instanceof AbstractConfigObject
|
||||
|| other instanceof Unresolved) {
|
||||
|| other instanceof Unmergeable) {
|
||||
// since we are an object, and the fallback could be,
|
||||
// then a merge may be required; delay until we resolve.
|
||||
List<AbstractConfigValue> newStack = new ArrayList<AbstractConfigValue>();
|
||||
newStack.addAll(stack);
|
||||
if (other instanceof Unresolved)
|
||||
newStack.addAll(((Unresolved) other).unmergedValues());
|
||||
if (other instanceof Unmergeable)
|
||||
newStack.addAll(((Unmergeable) other).unmergedValues());
|
||||
else
|
||||
newStack.add((AbstractConfigValue) other);
|
||||
return new ConfigDelayedMergeObject(
|
||||
|
@ -16,7 +16,7 @@ import com.typesafe.config.ConfigValueType;
|
||||
* than one piece it always resolves to a string via value concatenation.
|
||||
*/
|
||||
final class ConfigSubstitution extends AbstractConfigValue implements
|
||||
Unresolved {
|
||||
Unmergeable {
|
||||
|
||||
// this is a list of String and Path where the Path
|
||||
// have to be resolved to values, then if there's more
|
||||
@ -44,13 +44,13 @@ final class ConfigSubstitution extends AbstractConfigValue implements
|
||||
@Override
|
||||
public AbstractConfigValue withFallback(ConfigValue other) {
|
||||
if (other instanceof AbstractConfigObject
|
||||
|| other instanceof Unresolved) {
|
||||
|| other instanceof Unmergeable) {
|
||||
// if we turn out to be an object, and the fallback also does,
|
||||
// then a merge may be required; delay until we resolve.
|
||||
List<AbstractConfigValue> newStack = new ArrayList<AbstractConfigValue>();
|
||||
newStack.add(this);
|
||||
if (other instanceof Unresolved)
|
||||
newStack.addAll(((Unresolved) other).unmergedValues());
|
||||
if (other instanceof Unmergeable)
|
||||
newStack.addAll(((Unmergeable) other).unmergedValues());
|
||||
else
|
||||
newStack.add((AbstractConfigValue) other);
|
||||
return new ConfigDelayedMerge(
|
||||
|
13
src/main/java/com/typesafe/config/impl/Unmergeable.java
Normal file
13
src/main/java/com/typesafe/config/impl/Unmergeable.java
Normal file
@ -0,0 +1,13 @@
|
||||
package com.typesafe.config.impl;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Interface that tags a ConfigValue that is not mergeable until after
|
||||
* substitutions are resolved. Basically these are special ConfigValue that
|
||||
* never appear in a resolved tree, like {@link ConfigSubstitution} and
|
||||
* {@link ConfigDelayedMerge}.
|
||||
*/
|
||||
interface Unmergeable {
|
||||
Collection<? extends AbstractConfigValue> unmergedValues();
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package com.typesafe.config.impl;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Interface that tags a ConfigValue that is inherently not resolved; i.e. a
|
||||
* subclass of ConfigValue that will not appear in a resolved tree of values.
|
||||
* Types such as ConfigObject may not be resolved _yet_, but they are not
|
||||
* inherently unresolved.
|
||||
*/
|
||||
interface Unresolved {
|
||||
Collection<? extends AbstractConfigValue> unmergedValues();
|
||||
}
|
Loading…
Reference in New Issue
Block a user