mirror of
https://github.com/lightbend/config.git
synced 2025-03-22 07:10:23 +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
|
@Override
|
||||||
public AbstractConfigObject withFallback(ConfigValue other) {
|
public AbstractConfigObject withFallback(ConfigValue other) {
|
||||||
if (other instanceof Unresolved) {
|
if (other instanceof Unmergeable) {
|
||||||
List<AbstractConfigValue> stack = new ArrayList<AbstractConfigValue>();
|
List<AbstractConfigValue> stack = new ArrayList<AbstractConfigValue>();
|
||||||
stack.add(this);
|
stack.add(this);
|
||||||
stack.addAll(((Unresolved) other).unmergedValues());
|
stack.addAll(((Unmergeable) other).unmergedValues());
|
||||||
return new ConfigDelayedMergeObject(mergeOrigins(stack), stack);
|
return new ConfigDelayedMergeObject(mergeOrigins(stack), stack);
|
||||||
} else if (other instanceof AbstractConfigObject) {
|
} else if (other instanceof AbstractConfigObject) {
|
||||||
AbstractConfigObject fallback = (AbstractConfigObject) other;
|
AbstractConfigObject fallback = (AbstractConfigObject) other;
|
||||||
|
@ -18,7 +18,7 @@ import com.typesafe.config.ConfigValueType;
|
|||||||
* substitutions.
|
* substitutions.
|
||||||
*/
|
*/
|
||||||
final class ConfigDelayedMerge extends AbstractConfigValue implements
|
final class ConfigDelayedMerge extends AbstractConfigValue implements
|
||||||
Unresolved {
|
Unmergeable {
|
||||||
|
|
||||||
// earlier items in the stack win
|
// earlier items in the stack win
|
||||||
final private List<AbstractConfigValue> stack;
|
final private List<AbstractConfigValue> stack;
|
||||||
@ -88,13 +88,13 @@ final class ConfigDelayedMerge extends AbstractConfigValue implements
|
|||||||
@Override
|
@Override
|
||||||
public AbstractConfigValue withFallback(ConfigValue other) {
|
public AbstractConfigValue withFallback(ConfigValue other) {
|
||||||
if (other instanceof AbstractConfigObject
|
if (other instanceof AbstractConfigObject
|
||||||
|| other instanceof Unresolved) {
|
|| other instanceof Unmergeable) {
|
||||||
// if we turn out to be an object, and the fallback also does,
|
// if we turn out to be an object, and the fallback also does,
|
||||||
// then a merge may be required; delay until we resolve.
|
// then a merge may be required; delay until we resolve.
|
||||||
List<AbstractConfigValue> newStack = new ArrayList<AbstractConfigValue>();
|
List<AbstractConfigValue> newStack = new ArrayList<AbstractConfigValue>();
|
||||||
newStack.addAll(stack);
|
newStack.addAll(stack);
|
||||||
if (other instanceof Unresolved)
|
if (other instanceof Unmergeable)
|
||||||
newStack.addAll(((Unresolved) other).unmergedValues());
|
newStack.addAll(((Unmergeable) other).unmergedValues());
|
||||||
else
|
else
|
||||||
newStack.add((AbstractConfigValue) other);
|
newStack.add((AbstractConfigValue) other);
|
||||||
return new ConfigDelayedMerge(
|
return new ConfigDelayedMerge(
|
||||||
|
@ -14,7 +14,7 @@ import com.typesafe.config.ConfigValue;
|
|||||||
// This is just like ConfigDelayedMerge except we know statically
|
// This is just like ConfigDelayedMerge except we know statically
|
||||||
// that it will turn out to be an object.
|
// that it will turn out to be an object.
|
||||||
class ConfigDelayedMergeObject extends AbstractConfigObject implements
|
class ConfigDelayedMergeObject extends AbstractConfigObject implements
|
||||||
Unresolved {
|
Unmergeable {
|
||||||
|
|
||||||
final private List<AbstractConfigValue> stack;
|
final private List<AbstractConfigValue> stack;
|
||||||
|
|
||||||
@ -85,13 +85,13 @@ class ConfigDelayedMergeObject extends AbstractConfigObject implements
|
|||||||
@Override
|
@Override
|
||||||
public ConfigDelayedMergeObject withFallback(ConfigValue other) {
|
public ConfigDelayedMergeObject withFallback(ConfigValue other) {
|
||||||
if (other instanceof AbstractConfigObject
|
if (other instanceof AbstractConfigObject
|
||||||
|| other instanceof Unresolved) {
|
|| other instanceof Unmergeable) {
|
||||||
// since we are an object, and the fallback could be,
|
// since we are an object, and the fallback could be,
|
||||||
// then a merge may be required; delay until we resolve.
|
// then a merge may be required; delay until we resolve.
|
||||||
List<AbstractConfigValue> newStack = new ArrayList<AbstractConfigValue>();
|
List<AbstractConfigValue> newStack = new ArrayList<AbstractConfigValue>();
|
||||||
newStack.addAll(stack);
|
newStack.addAll(stack);
|
||||||
if (other instanceof Unresolved)
|
if (other instanceof Unmergeable)
|
||||||
newStack.addAll(((Unresolved) other).unmergedValues());
|
newStack.addAll(((Unmergeable) other).unmergedValues());
|
||||||
else
|
else
|
||||||
newStack.add((AbstractConfigValue) other);
|
newStack.add((AbstractConfigValue) other);
|
||||||
return new ConfigDelayedMergeObject(
|
return new ConfigDelayedMergeObject(
|
||||||
|
@ -16,7 +16,7 @@ import com.typesafe.config.ConfigValueType;
|
|||||||
* than one piece it always resolves to a string via value concatenation.
|
* than one piece it always resolves to a string via value concatenation.
|
||||||
*/
|
*/
|
||||||
final class ConfigSubstitution extends AbstractConfigValue implements
|
final class ConfigSubstitution extends AbstractConfigValue implements
|
||||||
Unresolved {
|
Unmergeable {
|
||||||
|
|
||||||
// this is a list of String and Path where the Path
|
// this is a list of String and Path where the Path
|
||||||
// have to be resolved to values, then if there's more
|
// have to be resolved to values, then if there's more
|
||||||
@ -44,13 +44,13 @@ final class ConfigSubstitution extends AbstractConfigValue implements
|
|||||||
@Override
|
@Override
|
||||||
public AbstractConfigValue withFallback(ConfigValue other) {
|
public AbstractConfigValue withFallback(ConfigValue other) {
|
||||||
if (other instanceof AbstractConfigObject
|
if (other instanceof AbstractConfigObject
|
||||||
|| other instanceof Unresolved) {
|
|| other instanceof Unmergeable) {
|
||||||
// if we turn out to be an object, and the fallback also does,
|
// if we turn out to be an object, and the fallback also does,
|
||||||
// then a merge may be required; delay until we resolve.
|
// then a merge may be required; delay until we resolve.
|
||||||
List<AbstractConfigValue> newStack = new ArrayList<AbstractConfigValue>();
|
List<AbstractConfigValue> newStack = new ArrayList<AbstractConfigValue>();
|
||||||
newStack.add(this);
|
newStack.add(this);
|
||||||
if (other instanceof Unresolved)
|
if (other instanceof Unmergeable)
|
||||||
newStack.addAll(((Unresolved) other).unmergedValues());
|
newStack.addAll(((Unmergeable) other).unmergedValues());
|
||||||
else
|
else
|
||||||
newStack.add((AbstractConfigValue) other);
|
newStack.add((AbstractConfigValue) other);
|
||||||
return new ConfigDelayedMerge(
|
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