summaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java
diff options
context:
space:
mode:
Diffstat (limited to 'config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java')
-rw-r--r--config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java b/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java
index d98869e9dd3..4ff54d7ff1c 100644
--- a/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java
+++ b/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java
@@ -4,8 +4,10 @@ package com.yahoo.documentmodel;
import com.yahoo.document.DataType;
import com.yahoo.document.Document;
import com.yahoo.document.Field;
+import com.yahoo.document.ReferenceDataType;
import com.yahoo.document.StructDataType;
import com.yahoo.document.StructuredDataType;
+import com.yahoo.document.TemporaryStructuredDataType;
import com.yahoo.document.annotation.AnnotationType;
import com.yahoo.document.annotation.AnnotationTypeRegistry;
import com.yahoo.document.datatypes.FieldValue;
@@ -383,4 +385,18 @@ public final class NewDocumentType extends StructuredDataType implements DataTyp
}
+ private ReferenceDataType refToThis = null;
+
+ @SuppressWarnings("deprecation")
+ public ReferenceDataType getReferenceDataType() {
+ if (refToThis == null) {
+ // super ugly, the APIs for this are horribly inconsistent
+ var tmptmp = TemporaryStructuredDataType.create(getName());
+ var tmp = ReferenceDataType.createWithInferredId(tmptmp);
+ tmp.setTargetType((StructuredDataType) this);
+ refToThis = tmp;
+ }
+ return refToThis;
+ }
+
}