aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/documentmodel/OwnedTemporaryType.java
diff options
context:
space:
mode:
authorArne H Juul <arnej@yahooinc.com>2022-03-23 11:24:40 +0000
committerArne H Juul <arnej@yahooinc.com>2022-03-23 11:24:40 +0000
commit484787c0bcdb46d2748905fad3346df07a4a4770 (patch)
treed629e3f7f5bb16344fd67cfd195f0693de8871cc /config-model/src/main/java/com/yahoo/documentmodel/OwnedTemporaryType.java
parent54329a8946debe301d2036397bc4a9d47764555f (diff)
add two new classes
* to be used instead of dual-purpose TemporaryStructuredDataType
Diffstat (limited to 'config-model/src/main/java/com/yahoo/documentmodel/OwnedTemporaryType.java')
-rw-r--r--config-model/src/main/java/com/yahoo/documentmodel/OwnedTemporaryType.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/config-model/src/main/java/com/yahoo/documentmodel/OwnedTemporaryType.java b/config-model/src/main/java/com/yahoo/documentmodel/OwnedTemporaryType.java
new file mode 100644
index 00000000000..536c10ee242
--- /dev/null
+++ b/config-model/src/main/java/com/yahoo/documentmodel/OwnedTemporaryType.java
@@ -0,0 +1,41 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.documentmodel;
+
+import com.yahoo.document.DocumentType;
+import com.yahoo.document.StructDataType;
+
+/**
+ * Proxy for a struct type declared in a specific document
+ *
+ * @author arnej
+ **/
+public final class OwnedTemporaryType extends StructDataType implements OwnedType {
+
+ private final String ownerName;
+ private final String uniqueName;
+
+ public OwnedTemporaryType(String name, DocumentType document) {
+ this(name, document.getName());
+ }
+
+ public OwnedTemporaryType(String name, String owner) {
+ super(name);
+ this.ownerName = owner;
+ this.uniqueName = name + "@" + owner;
+ }
+
+ @Override
+ public String getOwnerName() {
+ return ownerName;
+ }
+
+ @Override
+ public String getUniqueName() {
+ return uniqueName;
+ }
+
+ @Override
+ public String toString() {
+ return "{OwnedTemporaryType "+uniqueName+" id="+getId()+" uid="+getUniqueId()+"}";
+ }
+}