Skip to content

Commit

Permalink
[BEAM-7274] Add DynamicMessage Schema support
Browse files Browse the repository at this point in the history
Add DynamicMessage schema support. This is different from
generated classes as it uses the proto descriptors. It uses
the ProtoDomain as an index for searching embedded messages.
  • Loading branch information
alexvanboxel committed Jan 7, 2020
1 parent 11784ee commit 04a8580
Show file tree
Hide file tree
Showing 7 changed files with 1,219 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,13 @@ public FieldType getBaseType() {
}

/** Create a {@link Value} specifying which field to set and the value to set. */
public <T> Value createValue(String caseType, T value) {
return createValue(getCaseEnumType().valueOf(caseType), value);
public <T> Value createValue(String caseValue, T value) {
return createValue(getCaseEnumType().valueOf(caseValue), value);
}

/** Create a {@link Value} specifying which field to set and the value to set. */
public <T> Value createValue(int caseValue, T value) {
return createValue(getCaseEnumType().valueOf(caseValue), value);
}

/** Create a {@link Value} specifying which field to set and the value to set. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,15 @@ private void indexDescriptorByName() {
.values()
.forEach(
fileDescriptor -> {
fileDescriptor
.getMessageTypes()
.forEach(
descriptor -> {
descriptorMap.put(descriptor.getFullName(), descriptor);
});
fileDescriptor.getMessageTypes().forEach(descriptor -> indexDescriptor(descriptor));
});
}

private void indexDescriptor(Descriptors.Descriptor descriptor) {
descriptorMap.put(descriptor.getFullName(), descriptor);
descriptor.getNestedTypes().forEach(nested -> indexDescriptor(nested));
}

private void indexOptionsByNumber(Collection<Descriptors.FileDescriptor> fileDescriptors) {
fieldOptionMap = new HashMap<>();
fileOptionMap = new HashMap<>();
Expand Down
Loading

0 comments on commit 04a8580

Please sign in to comment.