public static void getAllFileDescriptors ( DescriptorProtos . FileDescriptorSet set , Map < String , Set < Descriptors . FileDescriptor > > dependenciesMap , Map < String , Descriptors . FileDescriptor > fileDescriptorMap ) throws StageException { List < DescriptorProtos . FileDescriptorProto > fileList = set . getFileList ( ) ; try { for ( DescriptorProtos . FileDescriptorProto fdp : fileList ) { if ( ! fileDescriptorMap . containsKey ( fdp . getName ( ) ) ) { Set < Descriptors . FileDescriptor > dependencies = dependenciesMap . get ( fdp . getName ( ) ) ; if ( dependencies == null ) { dependencies = new LinkedHashSet <> ( ) ; dependenciesMap . put ( fdp . getName ( ) , dependencies ) ; dependencies . addAll ( getDependencies ( dependenciesMap , fileDescriptorMap , fdp , set ) ) ; } Descriptors . FileDescriptor fileDescriptor = Descriptors . FileDescriptor . buildFrom ( fdp , dependencies . toArray ( new Descriptors . FileDescriptor [ dependencies . size ( ) ] ) ) ; fileDescriptorMap . put ( fdp . getName ( ) , fileDescriptor ) ; } } } catch ( Descriptors . DescriptorValidationException e ) { throw new StageException ( Errors . PROTOBUF_07 , e . getDescription ( ) , e ) ; } }
Loads a Protobuf file descriptor set into an ubermap of file descriptors .