All Downloads are FREE. Search and download functionalities are using the official Maven repository.

datahub.protobuf.visitors.field.SchemaFieldVisitor Maven / Gradle / Ivy

There is a newer version: 0.14.1
Show newest version
package datahub.protobuf.visitors.field;

import com.linkedin.schema.SchemaField;
import com.linkedin.util.Pair;
import datahub.protobuf.model.ProtobufField;
import datahub.protobuf.visitors.ProtobufModelVisitor;
import datahub.protobuf.visitors.VisitContext;

import java.util.stream.Stream;

public class SchemaFieldVisitor implements ProtobufModelVisitor> {

    @Override
    public Stream> visitField(ProtobufField field, VisitContext context) {
        return context.streamAllPaths(field).map(path ->
                Pair.of(
                        new SchemaField()
                                .setFieldPath(context.getFieldPath(path))
                                .setNullable(true)
                                .setDescription(field.comment())
                                .setNativeDataType(field.nativeType())
                                .setType(field.schemaFieldDataType()),
                        context.calculateSortOrder(path, field)));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy