private Builder override(Builder __superior) { if (__superior.id != null) id(__superior.id); if (__superior.name != null) name(__superior.name); if (__superior.version != null) version(__superior.version); if (__superior.headerstruct != null) headerstruct(__superior.headerstruct); if (__superior.bodystruct != null) bodystruct(__superior.bodystruct); if (!__superior.inherits.isEmpty()) inherits.addAll(__superior.inherits); if (!__superior.datatype.isEmpty()) datatype.addAll(__superior.datatype); if (!__superior.annotationtype.isEmpty()) annotationtype.addAll(__superior.annotationtype); fieldsets(__superior.fieldsets); if (!__superior.referencetype.isEmpty()) referencetype.addAll(__superior.referencetype); return this; }
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); } }
private void buildConfig(NewDocumentType documentType, DocumenttypesConfig.Builder builder) { if (documentType == VespaDocumentType.INSTANCE) { return; } DocumenttypesConfig.Documenttype.Builder db = new DocumenttypesConfig.Documenttype.Builder(); db. id(documentType.getId()). name(documentType.getName()). headerstruct(documentType.getHeader().getId()). bodystruct(documentType.getBody().getId()); Set<Integer> built = new HashSet<>(); for (NewDocumentType inherited : documentType.getInherited()) { db.inherits(new DocumenttypesConfig.Documenttype.Inherits.Builder().id(inherited.getId())); markAsBuilt(built, inherited.getAllTypes()); } for (DataType dt : documentType.getTypes()) { buildConfig(dt, db, built); } for (AnnotationType annotation : documentType.getAnnotations()) { DocumenttypesConfig.Documenttype.Annotationtype.Builder atb = new DocumenttypesConfig.Documenttype.Annotationtype.Builder(); db.annotationtype(atb); buildConfig(annotation, atb); } buildConfig(documentType.getFieldSets(), db); builder.documenttype(db); }
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)); } }
private Builder headerstruct(String __value) { return headerstruct(Integer.valueOf(__value)); }
private Builder id(String __value) { return id(Integer.valueOf(__value)); }
private void buildConfig(FieldSet fs, DocumenttypesConfig.Documenttype.Builder db) { db.fieldsets(fs.getName(), new DocumenttypesConfig.Documenttype.Fieldsets.Builder().fields(fs.getFieldNames())); }
private Builder bodystruct(String __value) { return bodystruct(Integer.valueOf(__value)); }
private void buildConfig(ReferenceDataType type, DocumenttypesConfig.Documenttype.Builder documentBuilder) { ReferenceDataType refType = type; DocumenttypesConfig.Documenttype.Referencetype.Builder refBuilder = new DocumenttypesConfig.Documenttype.Referencetype.Builder(); refBuilder.id(refType.getId()); refBuilder.target_type_id(type.getTargetType().getId()); documentBuilder.referencetype(refBuilder); }
public Builder(DocumenttypesConfig config) { enablecompression(config.enablecompression()); for (Documenttype d : config.documenttype()) { documenttype(new Documenttype.Builder(d)); } }