Search in sources :

Example 1 with FixedResourceNameConfig

use of com.google.api.codegen.config.FixedResourceNameConfig in project toolkit by googleapis.

the class PathTemplateTransformer method generateResourceNames.

List<ResourceNameView> generateResourceNames(InterfaceContext context, Iterable<ResourceNameConfig> configs) {
    List<ResourceNameView> resourceNames = new ArrayList<>();
    int index = 1;
    for (ResourceNameConfig config : configs) {
        switch(config.getResourceNameType()) {
            case SINGLE:
                resourceNames.add(generateResourceNameSingle(context, index, (SingleResourceNameConfig) config));
                break;
            case ONEOF:
                resourceNames.add(generateResourceNameOneof(context, index, (ResourceNameOneofConfig) config));
                break;
            case FIXED:
                resourceNames.add(generateResourceNameFixed(context, index, (FixedResourceNameConfig) config));
                break;
            default:
                throw new IllegalStateException("Unexpected resource-name type.");
        }
        index += 1;
    }
    return resourceNames;
}
Also used : ResourceNameView(com.google.api.codegen.viewmodel.ResourceNameView) ResourceNameOneofConfig(com.google.api.codegen.config.ResourceNameOneofConfig) FixedResourceNameConfig(com.google.api.codegen.config.FixedResourceNameConfig) ArrayList(java.util.ArrayList) SingleResourceNameConfig(com.google.api.codegen.config.SingleResourceNameConfig) SingleResourceNameConfig(com.google.api.codegen.config.SingleResourceNameConfig) ResourceNameConfig(com.google.api.codegen.config.ResourceNameConfig) FixedResourceNameConfig(com.google.api.codegen.config.FixedResourceNameConfig)

Aggregations

FixedResourceNameConfig (com.google.api.codegen.config.FixedResourceNameConfig)1 ResourceNameConfig (com.google.api.codegen.config.ResourceNameConfig)1 ResourceNameOneofConfig (com.google.api.codegen.config.ResourceNameOneofConfig)1 SingleResourceNameConfig (com.google.api.codegen.config.SingleResourceNameConfig)1 ResourceNameView (com.google.api.codegen.viewmodel.ResourceNameView)1 ArrayList (java.util.ArrayList)1