diff options
Diffstat (limited to 'config-model/src/main/java/com/yahoo/documentmodel')
-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; |