use of com.linkedin.avroutil1.model.AvroSchemaField in project avro-util by linkedin.
the class AvscFileParseContext method resolveReferences.
private void resolveReferences(AvroSchema schema) {
AvroType type = schema.type();
switch(type) {
case RECORD:
AvroRecordSchema recordSchema = (AvroRecordSchema) schema;
List<AvroSchemaField> fields = recordSchema.getFields();
for (AvroSchemaField field : fields) {
SchemaOrRef fieldSchema = field.getSchemaOrRef();
resolveReferences(fieldSchema);
}
break;
case UNION:
AvroUnionSchema unionSchema = (AvroUnionSchema) schema;
List<SchemaOrRef> types = unionSchema.getTypes();
for (SchemaOrRef unionType : types) {
resolveReferences(unionType);
}
break;
case ARRAY:
AvroArraySchema arraySchema = (AvroArraySchema) schema;
SchemaOrRef arrayValuesType = arraySchema.getValueSchemaOrRef();
resolveReferences(arrayValuesType);
break;
case MAP:
AvroMapSchema mapSchema = (AvroMapSchema) schema;
SchemaOrRef mapValuesType = mapSchema.getValueSchemaOrRef();
resolveReferences(mapValuesType);
break;
default:
break;
}
}
Aggregations