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(StructDataType type, DocumenttypesConfig.Documenttype.Datatype.Builder dataTypeBuilder, DocumenttypesConfig.Documenttype.Builder documentBuilder, Set<Integer> built) { dataTypeBuilder.type(DocumenttypesConfig.Documenttype.Datatype.Type.Enum.STRUCT); DocumenttypesConfig.Documenttype.Datatype.Sstruct.Builder structBuilder = new DocumenttypesConfig.Documenttype.Datatype.Sstruct.Builder(); dataTypeBuilder.sstruct(structBuilder); structBuilder.name(type.getName()); if (type.getCompressionConfig().type.getCode() != 0) { structBuilder.compression(new DocumenttypesConfig.Documenttype.Datatype.Sstruct.Compression.Builder(). type(DocumenttypesConfig.Documenttype.Datatype.Sstruct.Compression.Type.Enum.valueOf(type.getCompressionConfig().type.toString())). level(type.getCompressionConfig().compressionLevel). threshold((int) type.getCompressionConfig().threshold). minsize((int) type.getCompressionConfig().minsize)); } for (com.yahoo.document.Field field : type.getFields()) { DocumenttypesConfig.Documenttype.Datatype.Sstruct.Field.Builder builder = new DocumenttypesConfig.Documenttype.Datatype.Sstruct.Field.Builder(); builder.name(field.getName()). id(field.getId()). id_v6(field.getIdV6()). datatype(field.getDataType().getId()); if (field.getDataType() instanceof TensorDataType) { builder.detailedtype(((TensorDataType) field.getDataType()).getTensorType().toString()); } structBuilder.field(builder); buildConfig(field.getDataType(), documentBuilder, built); } }
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 id(String __value) { return id(Integer.valueOf(__value)); }
private Builder type(String __value) { return type(Type.Enum.valueOf(__value)); }
private void buildConfig(AnnotationReferenceDataType type, DocumenttypesConfig.Documenttype.Datatype.Builder dataTypeBuilder) { dataTypeBuilder. type(DocumenttypesConfig.Documenttype.Datatype.Type.Enum.ANNOTATIONREF). annotationref(new DocumenttypesConfig.Documenttype.Datatype.Annotationref.Builder(). annotation(new DocumenttypesConfig.Documenttype.Datatype.Annotationref.Annotation.Builder(). id(type.getAnnotationType().getId()))); }
private void buildConfig(MapDataType type, DocumenttypesConfig.Documenttype.Datatype.Builder dataTypeBuilder, DocumenttypesConfig.Documenttype.Builder documentBuilder, Set<Integer> built) { dataTypeBuilder. type(DocumenttypesConfig.Documenttype.Datatype.Type.Enum.MAP). map(new DocumenttypesConfig.Documenttype.Datatype.Map.Builder(). key(new DocumenttypesConfig.Documenttype.Datatype.Map.Key.Builder(). id(type.getKeyType().getId())). value(new DocumenttypesConfig.Documenttype.Datatype.Map.Value.Builder(). id(type.getValueType().getId()))); buildConfig(type.getKeyType(), documentBuilder, built); buildConfig(type.getValueType(), documentBuilder, built); }
private void buildConfig(ArrayDataType type, DocumenttypesConfig.Documenttype.Datatype.Builder dataTypeBuilder, DocumenttypesConfig.Documenttype.Builder documentBuilder, Set<Integer> built) { dataTypeBuilder. type(DocumenttypesConfig.Documenttype.Datatype.Type.Enum.ARRAY). array(new DocumenttypesConfig.Documenttype.Datatype.Array.Builder(). element(new DocumenttypesConfig.Documenttype.Datatype.Array.Element.Builder().id(type.getNestedType().getId()))); buildConfig(type.getNestedType(), documentBuilder, built); }
private Builder override(Builder __superior) { if (__superior.id != null) id(__superior.id); if (__superior.type != null) type(__superior.type); array(array.override(__superior.array)); map(map.override(__superior.map)); wset(wset.override(__superior.wset)); annotationref(annotationref.override(__superior.annotationref)); sstruct(sstruct.override(__superior.sstruct)); return this; }
private void buildConfig(WeightedSetDataType type, DocumenttypesConfig.Documenttype.Datatype.Builder dataTypeBuilder, DocumenttypesConfig.Documenttype.Builder documentBuilder, Set<Integer> built) { dataTypeBuilder.type(DocumenttypesConfig.Documenttype.Datatype.Type.Enum.WSET). wset(new DocumenttypesConfig.Documenttype.Datatype.Wset.Builder(). key(new DocumenttypesConfig.Documenttype.Datatype.Wset.Key.Builder(). id(type.getNestedType().getId())). createifnonexistent(type.createIfNonExistent()). removeifzero(type.removeIfZero())); buildConfig(type.getNestedType(), documentBuilder, built); }
public Builder(Datatype config) { id(config.id()); type(config.type()); array(new Array.Builder(config.array())); map(new Map.Builder(config.map())); wset(new Wset.Builder(config.wset())); annotationref(new Annotationref.Builder(config.annotationref())); sstruct(new Sstruct.Builder(config.sstruct())); }