diff options
author | Arne H Juul <arnej@yahooinc.com> | 2022-03-18 13:23:07 +0000 |
---|---|---|
committer | Arne H Juul <arnej@yahooinc.com> | 2022-03-18 13:23:07 +0000 |
commit | 466ab8c7bee231d4ea85643d3cdd1e64ef5c3f29 (patch) | |
tree | 25f961b09421bca903f2b405f6f8bef77b9d1860 /config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java | |
parent | b5cfd7d01b0f2eac9b86c66664d42953efb84049 (diff) |
restore method used elsewhere
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.java | 18 |
1 files changed, 18 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 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<Document> getValueClass() { return Document.class; |