use of com.google.api.codegen.config.SampleParameterConfig in project toolkit by googleapis.
the class SampleTransformer method sampleParamConfigMapFromRequestConfigs.
private ImmutableMap<String, SampleParameterConfig> sampleParamConfigMapFromRequestConfigs(List<RequestFieldProto> requests) {
ImmutableMap.Builder<String, SampleParameterConfig> builder = ImmutableMap.builder();
for (RequestFieldProto request : requests) {
String field = request.getField();
SampleParameterConfig config = SampleParameterConfig.newBuilder().field(field).isFile(request.getValueIsFile()).inputParameter(request.getInputParameter()).comment(request.getComment()).build();
builder.put(field, config);
}
return builder.build();
}
use of com.google.api.codegen.config.SampleParameterConfig in project toolkit by googleapis.
the class SampleTransformer method sampleParamConfigMapFromValueSet.
private ImmutableMap<String, SampleParameterConfig> sampleParamConfigMapFromValueSet(SampleValueSet valueSet) {
ImmutableMap.Builder<String, SampleParameterConfig> builder = ImmutableMap.builder();
for (SampleInitAttribute attr : valueSet.getParameters().getAttributesList()) {
String field = attr.getParameter();
SampleParameterConfig config = SampleParameterConfig.newBuilder().field(field).isFile(attr.getReadFile()).inputParameter(attr.getSampleArgumentName()).comment(attr.getDescription()).build();
builder.put(field, config);
}
return builder.build();
}
use of com.google.api.codegen.config.SampleParameterConfig in project toolkit by googleapis.
the class InitCodeNode method resolveSampleParamConfigs.
private void resolveSampleParamConfigs(InitCodeContext context, Map<String, SampleParameterConfig> configs) {
for (Map.Entry<String, SampleParameterConfig> entry : configs.entrySet()) {
Scanner scanner = new Scanner(entry.getKey());
InitCodeNode parent = FieldStructureParser.parsePath(this, scanner);
int token = scanner.lastToken();
if (token == Scanner.EOF) {
parent.resolveSampleParamConfig(context, entry.getValue());
} else if (token == '%') {
Preconditions.checkArgument(scanner.scan() == Scanner.IDENT, "expected IDENT after '%': %s", entry.getKey());
String entityName = scanner.tokenStr();
Preconditions.checkArgument(scanner.scan() == Scanner.EOF, "expected EOF after entity name: %s", entityName);
parent.resolveSampleParamConfig(context, entityName, entry.getValue());
}
}
}
Aggregations