use of com.google.protobuf.Descriptors.FileDescriptor in project beam by apache.
the class BeamRowToStorageApiProto method getDescriptorFromSchema.
/**
* Given a Beam Schema, returns a protocol-buffer Descriptor that can be used to write data using
* the BigQuery Storage API.
*/
public static Descriptor getDescriptorFromSchema(Schema schema) throws DescriptorValidationException {
DescriptorProto descriptorProto = descriptorSchemaFromBeamSchema(schema);
FileDescriptorProto fileDescriptorProto = FileDescriptorProto.newBuilder().addMessageType(descriptorProto).build();
FileDescriptor fileDescriptor = FileDescriptor.buildFrom(fileDescriptorProto, new FileDescriptor[0]);
return Iterables.getOnlyElement(fileDescriptor.getMessageTypes());
}
use of com.google.protobuf.Descriptors.FileDescriptor in project beam by apache.
the class TableRowToStorageApiProto method getDescriptorFromTableSchema.
/**
* Given a BigQuery TableSchema, returns a protocol-buffer Descriptor that can be used to write
* data using the BigQuery Storage API.
*/
public static Descriptor getDescriptorFromTableSchema(TableSchema jsonSchema) throws DescriptorValidationException {
DescriptorProto descriptorProto = descriptorSchemaFromTableSchema(jsonSchema);
FileDescriptorProto fileDescriptorProto = FileDescriptorProto.newBuilder().addMessageType(descriptorProto).build();
FileDescriptor fileDescriptor = FileDescriptor.buildFrom(fileDescriptorProto, new FileDescriptor[0]);
return Iterables.getOnlyElement(fileDescriptor.getMessageTypes());
}
use of com.google.protobuf.Descriptors.FileDescriptor in project core-java by SpineEventEngine.
the class CommandsShould method return_false_if_file_is_not_for_commands.
@Test
public void return_false_if_file_is_not_for_commands() {
final FileDescriptor file = StringValue.getDescriptor().getFile();
assertFalse(Commands.isCommandsFile(file));
}
use of com.google.protobuf.Descriptors.FileDescriptor in project core-java by SpineEventEngine.
the class CommandsShould method return_true_if_file_is_for_commands.
@Test
public void return_true_if_file_is_for_commands() {
final FileDescriptor file = TestCommand.getDescriptor().getFile();
assertTrue(Commands.isCommandsFile(file));
}
use of com.google.protobuf.Descriptors.FileDescriptor in project atlasdb by palantir.
the class ColumnValueDescription method persistFileDescriptorTree.
private static FileDescriptorTreeProto persistFileDescriptorTree(FileDescriptor file) {
FileDescriptorTreeProto.Builder builder = FileDescriptorTreeProto.newBuilder();
builder.setProtoFileDescriptor(file.toProto().toByteString());
for (FileDescriptor dependency : file.getDependencies()) {
builder.addDependencies(persistFileDescriptorTree(dependency));
}
return builder.build();
}
Aggregations