title: Nested Protocol Buffers with reflection
body: <p>Say I have a Message in a .proto file with the following contents</p>
  
  <pre><code>Message Foo {
      Message Bar {
          optional int32 a = 1;
          optional int32 b = 2;
      }
      optional Bar bar = 1;
  }
  </code></pre>
  
  <p>In Java, is there anyway to set the field a using only the string "bar.a"?  Ideally I'd like to write a method like below:</p>
  
  <pre><code>public Foo.Builder apply(Foo.Builder builder, String fieldPath, Object value) {
      // fieldPath == "bar.a"
      // This doesn't work
      FieldDescriptor fd = builder.getDefaultInstanceForType().findFieldByName(fieldPath);
      builder = builder.setField(fd, value);
  }
  </code></pre>
  
  <p>But when I do this, I get an IllegalArgumentException.</p>
  
  <p>Does anyone know how to do this in a generic fashion?</p>
  
  <p>I also need to go the other way as well</p>
  
  <pre><code>public Object getValue(Foo message, String fieldPath) {
      // This doesn't work
      FieldDescriptor fd = message.getDefaultInstanceForType().findFieldByName(fieldPath);
      return message.getField(fieldPath);
  }
  </code></pre>
  
  <p>As a note, this works fine if the fieldPath does not contain a separator (".") and references a base Message, but not a nested Message.</p>