Package com.google.protobuf.Descriptors

Examples of com.google.protobuf.Descriptors.FileDescriptor


        new CachedDescriptorRetriever() {
          protected FieldDescriptor loadDescriptor() {
            try {
              Class clazz =
                  singularType.getClassLoader().loadClass(descriptorOuterClass);
              FileDescriptor file =
                  (FileDescriptor) clazz.getField("descriptor").get(null);
              return file.findExtensionByName(extensionName);
            } catch (Exception e) {
              throw new RuntimeException(
                  "Cannot load descriptors: " + descriptorOuterClass +
                  " is not a valid descriptor class name", e);
            }
View Full Code Here


    }

    static ProtobufRowDataConverter buildConverter(HasStorage object,
                                                   FileDescriptorProto fileProto) {
        Group group = (Group)object;
        FileDescriptor fileDescriptor;
        try {
            fileDescriptor = FileDescriptor.buildFrom(fileProto, DEPENDENCIES);
        }
        catch (DescriptorValidationException ex) {
            throw new ProtobufBuildException(ex);
View Full Code Here

        a2p.addGroup(g);
        FileDescriptorSet set = a2p.build();
        if (false) {
            new ProtobufDecompiler((Appendable)System.out).decompile(set);
        }
        FileDescriptor gdesc = FileDescriptor.buildFrom(set.getFile(0),
                                                        ProtobufStorageDescriptionHelper.DEPENDENCIES);
        return ProtobufRowDataConverter.forGroup(g, gdesc);
    }
View Full Code Here

  public void testGetFileDescriptor() throws DescriptorValidationException {
    ThriftToDynamicProto<Person> converter = new ThriftToDynamicProto<Person>(Person.class);
    Person person = genPerson();
    Message msg = converter.convert(person);

    FileDescriptor expectedFd = msg.getDescriptorForType().getFile();
    FileDescriptor actualFd = converter.getFileDescriptor();

    assertEquals(expectedFd, actualFd);
  }
View Full Code Here

TOP

Related Classes of com.google.protobuf.Descriptors.FileDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.