@SuppressWarnings("deprecation")
private static void registerDocumentType(DocumentTypeManager manager, DocumentmanagerConfig.Datatype.Documenttype doc) {
StructDataType header = (StructDataType) manager.getDataType(doc.headerstruct(), "");
StructDataType body = (StructDataType) manager.getDataType(doc.bodystruct(), "");
for (Field field : body.getFields()) {
field.setHeader(false);
}
DocumentType type = new DocumentType(doc.name(), header, body);
for (Object j : doc.inherits()) {
DocumentmanagerConfig.Datatype.Documenttype.Inherits parent =
(DocumentmanagerConfig.Datatype.Documenttype.Inherits) j;
DataTypeName name = new DataTypeName(parent.name());
DocumentType parentType = manager.getDocumentType(name);
if (parentType == null) {
throw new IllegalArgumentException("Could not find document type '" + name.toString() + "'.");
}
type.inherit(parentType);
}
manager.register(type);
}