From 466ab8c7bee231d4ea85643d3cdd1e64ef5c3f29 Mon Sep 17 00:00:00 2001 From: Arne H Juul Date: Fri, 18 Mar 2022 13:23:07 +0000 Subject: restore method used elsewhere --- .../java/com/yahoo/documentmodel/NewDocumentType.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'config-model/src/main/java/com/yahoo/documentmodel') 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 c008b4f1e36..dd8edbdde6c 100644 --- a/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java +++ b/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java @@ -95,6 +95,24 @@ public final class NewDocumentType extends StructuredDataType implements DataTyp public NewDocumentType getInherited(Name inherited) { return inherits.get(inherited.getId()); } public NewDocumentType removeInherited(Name inherited) { return inherits.remove(inherited.getId()); } + /** + * Data type of the header fields of this and all inherited document types + * Used by DocumentGenMojo + * @return merged {@link StructDataType} + */ + public StructDataType allHeader() { + StructDataType ret = new StructDataType(contentStruct.getName()); + for (Field f : contentStruct.getFields()) { + ret.addField(f); + } + for (NewDocumentType inherited : getInherited()) { + for (Field f : ((StructDataType) inherited.getContentStruct()).getFields()) { + ret.addField(f); + } + } + return ret; + } + @Override public Class getValueClass() { return Document.class; -- cgit v1.2.3