/** * Sets the given scalar value on the field. If optional key is provided, the field must * represent a map, and the value under the key is set. */ public Builder setValue( FieldDescriptor field, @Nullable Object key, Object value, @Nullable Location location) { if (key == null) { configBuilder.setField(field, value); } else { putMapEntry(configBuilder, field, key, value); } addLocation(field, key, location); return this; }
/** * Sets the given scalar value on the field. If optional key is provided, the field must * represent a map, and the value under the key is set. */ public Builder setValue( FieldDescriptor field, @Nullable Object key, Object value, @Nullable Location location) { if (key == null) { configBuilder.setField(field, value); } else { putMapEntry(configBuilder, field, key, value); } addLocation(field, key, location); return this; }
/** This is mainly to add location for container fields like repeated or message fields. */ private void addExplicitLocationField( ConfigSource.Builder builder, FieldDescriptor field, Node value) { // This allows us to do get location of repeated/message field inside service config. Example: // name: "test.googleapis.com" // discovery: // public_discovery: true // Without this code, we will only be able to get location of primitive types inside a message // type and we won't be able to do something like: getLocation(serviceObject, "discovery") builder.addLocation(field, null, helper.getLocation(value)); }
/** This is mainly to add location for container fields like repeated or message fields. */ private void addExplicitLocationField( ConfigSource.Builder builder, FieldDescriptor field, Node value) { // This allows us to do get location of repeated/message field inside service config. Example: // name: "test.googleapis.com" // discovery: // public_discovery: true // Without this code, we will only be able to get location of primitive types inside a message // type and we won't be able to do something like: getLocation(serviceObject, "discovery") builder.addLocation(field, null, helper.getLocation(value)); }