code: protected static List<FieldDescriptor> getChildFieldDescriptors(final Descriptor type) {
      final List<FieldDescriptor> fields = new ArrayList<FieldDescriptor>();
  
      for (final FieldDescriptor field : type.getFields()) {
        if (field.getJavaType() == JavaType.MESSAGE) {
          fields.add(field);
        }
      }
  
      for (final FieldDescriptor field : type.getExtensions()) {
        if (field.getJavaType() == JavaType.MESSAGE) {
          fields.add(field);
        }
      }
  
      return Collections.unmodifiableList(fields);
    }
docs: Gets all child MessageOrBuilder descriptors for the type.
  
  @author protobufel@gmail.com David Tesler