private void buildConfig(DataType type, DocumenttypesConfig.Documenttype.Builder documentBuilder, Set<Integer> built) { if ((VespaDocumentType.INSTANCE.getDataType(type.getId()) == null) && !built.contains(type.getId())) { built.add(type.getId()); DocumenttypesConfig.Documenttype.Datatype.Builder dataTypeBuilder = new DocumenttypesConfig.Documenttype.Datatype.Builder(); dataTypeBuilder.id(type.getId()); if (type instanceof StructDataType) { buildConfig((StructDataType) type, dataTypeBuilder, documentBuilder, built); } else if (type instanceof ArrayDataType) { buildConfig((ArrayDataType) type, dataTypeBuilder, documentBuilder, built); } else if (type instanceof WeightedSetDataType) { buildConfig((WeightedSetDataType) type, dataTypeBuilder, documentBuilder, built); } else if (type instanceof MapDataType) { buildConfig((MapDataType) type, dataTypeBuilder, documentBuilder, built); } else if (type instanceof AnnotationReferenceDataType) { buildConfig((AnnotationReferenceDataType) type, dataTypeBuilder); } else if (type instanceof TensorDataType) { // The type of the tensor is not stored here but instead in each field as detailed type information // to provide better compatibility. A tensor field can have its tensorType changed (in compatible ways) // without changing the field type and thus requiring data refeed return; } else if (type instanceof ReferenceDataType) { buildConfig((ReferenceDataType) type, documentBuilder); return; } else { return; } documentBuilder.datatype(dataTypeBuilder); } }
public Builder(Documenttype config) { id(config.id()); name(config.name()); version(config.version()); headerstruct(config.headerstruct()); bodystruct(config.bodystruct()); for (Inherits i : config.inherits()) { inherits(new Inherits.Builder(i)); } for (Datatype d : config.datatype()) { datatype(new Datatype.Builder(d)); } for (Annotationtype a : config.annotationtype()) { annotationtype(new Annotationtype.Builder(a)); } for (Map.Entry<String, Fieldsets> __entry : config.fieldsets().entrySet()) { fieldsets(__entry.getKey(), new Fieldsets.Builder(__entry.getValue())); } for (Referencetype r : config.referencetype()) { referencetype(new Referencetype.Builder(r)); } }