@@ -0,0 +1,2651 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.%0Apackage com.yahoo.documentmodel;%0A%0Aimport com.yahoo.document.DataType;%0Aimport com.yahoo.document.StructuredDataType;%0Aimport com.yahoo.document.TemporaryStructuredDataType;%0Aimport com.yahoo.document.datatypes.FieldValue;%0A%0A/**%0A * @author arnej%0A */%0A@SuppressWarnings(%22deprecation%22)%0Apublic final class NewDocumentReferenceDataType extends DataType %7B%0A%0A    private StructuredDataType target;%0A    private final boolean temporary;%0A%0A    private NewDocumentReferenceDataType(NewDocumentType.Name nameAndId,%0A                                         StructuredDataType target,%0A                                         boolean temporary)%0A    %7B%0A        super(nameAndId.getName(), nameAndId.getId());%0A        this.target = target;%0A        this.temporary = temporary;%0A    %7D%0A%0A    private static NewDocumentType.Name buildTypeName(String documentName) %7B%0A        String typeName = %22Reference%3C%22 + documentName + %22%3E%22;%0A        return new NewDocumentType.Name(typeName);%0A    %7D%0A%0A    public NewDocumentReferenceDataType(String documentName) %7B%0A        this(buildTypeName(documentName), TemporaryStructuredDataType.create(documentName), true);%0A    %7D%0A%0A    public NewDocumentReferenceDataType(NewDocumentType document) %7B%0A        this(buildTypeName(document.getName()), document, false);%0A    %7D%0A%0A    public boolean isTemporary() %7B return temporary; %7D%0A%0A    public StructuredDataType getTargetType() %7B return target; %7D%0A%0A    public void setTargetType(StructuredDataType type) %7B%0A        assert(target.getName().equals(type.getName()));%0A        if (temporary) %7B%0A            this.target = type;%0A        %7D else %7B%0A            throw new IllegalStateException%0A                (String.format(%22Unexpected attempt to replace already concrete target %22 +%0A                               %22type in ReferenceDataType instance (type is '%25s')%22, target.getName()));%0A        %7D%0A    %7D%0A%0A    @Override%0A    public FieldValue createFieldValue() %7B%0A        throw new IllegalArgumentException(%22not implemented%22);%0A    %7D%0A%0A    @Override%0A    public Class%3CFieldValue%3E getValueClass() %7B%0A        throw new IllegalArgumentException(%22not implemented%22);%0A    %7D%0A%0A    @Override%0A    public boolean isValueCompatible(FieldValue value) %7B%0A        throw new IllegalArgumentException(%22not implemented%22);%0A    %7D%0A%0A    @Override%0A    public boolean equals(Object rhs) %7B%0A        if (rhs instanceof NewDocumentReferenceDataType) %7B%0A            var other = (NewDocumentReferenceDataType) rhs;%0A            return super.equals(other) && (temporary == other.temporary) && target.equals(other.target);%0A        %7D%0A        return false;%0A    %7D%0A%7D%0A

add new datatype model