summaryrefslogtreecommitdiffstats
path: root/config-lib
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-11-08 11:11:11 +0100
committerJon Bratseth <bratseth@gmail.com>2022-11-08 11:11:11 +0100
commit5046ad6259251bdaa5b03fb9cb367306150e2153 (patch)
tree13a6a7c4277fc7ec58b3825a56e95094d48d5a63 /config-lib
parent45000a2bf0f388d768c4791b3d06ff007096579a (diff)
Tolerate attempts to resolve multiple times
Diffstat (limited to 'config-lib')
-rw-r--r--config-lib/abi-spec.json1
-rw-r--r--config-lib/src/main/java/com/yahoo/config/ModelReference.java7
2 files changed, 6 insertions, 2 deletions
diff --git a/config-lib/abi-spec.json b/config-lib/abi-spec.json
index 6cfce9da0ba..caae2ebf1cf 100644
--- a/config-lib/abi-spec.json
+++ b/config-lib/abi-spec.json
@@ -336,6 +336,7 @@
"public"
],
"methods" : [
+ "public boolean isResolved()",
"public java.util.Optional modelId()",
"public java.util.Optional url()",
"public java.util.Optional path()",
diff --git a/config-lib/src/main/java/com/yahoo/config/ModelReference.java b/config-lib/src/main/java/com/yahoo/config/ModelReference.java
index 25caad55b84..fbf34c7ff23 100644
--- a/config-lib/src/main/java/com/yahoo/config/ModelReference.java
+++ b/config-lib/src/main/java/com/yahoo/config/ModelReference.java
@@ -32,13 +32,16 @@ public class ModelReference {
this.resolved = resolved;
}
+ /** Returns whether this is already resolved. */
+ public boolean isResolved() { return resolved != null; }
+
/** Returns the id specified for this model, oor null if it is resolved. */
public Optional<String> modelId() { return modelId; }
/** Returns the url specified for this model, or null if it is resolved. */
public Optional<UrlReference> url() { return url; }
- /** Returns the path specified for this model, oor null if it is resolved. */
+ /** Returns the path specified for this model, or null if it is resolved. */
public Optional<FileReference> path() { return path; }
/** Returns the path to the file containing this model, or null if this is unresolved. */
@@ -109,7 +112,7 @@ public class ModelReference {
return new ModelReference(modelId, url, path, null);
}
- /** Creates a nresolved reference. */
+ /** Creates a resolved reference. */
public static ModelReference resolved(Path path) {
return new ModelReference(null, null, null, Objects.requireNonNull(path));
}