Search in sources :

Example 16 with SingleResourceNameConfig

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

the class InitCodeTransformer method createCollectionMap.

/**
 * A utility method which creates the InitValueConfig map that contains the collection config
 * data.
 */
public static ImmutableMap<String, InitValueConfig> createCollectionMap(MethodContext context) {
    ImmutableMap.Builder<String, InitValueConfig> mapBuilder = ImmutableMap.builder();
    Map<String, String> fieldNamePatterns = context.getFieldResourceEntityMap();
    for (Map.Entry<String, String> fieldNamePattern : fieldNamePatterns.entrySet()) {
        SingleResourceNameConfig resourceNameConfig = context.getSingleResourceNameConfig(fieldNamePattern.getValue());
        String apiWrapperClassName = context.getNamer().getApiWrapperClassName(context.getInterfaceConfig());
        InitValueConfig initValueConfig = InitValueConfig.create(apiWrapperClassName, resourceNameConfig);
        mapBuilder.put(fieldNamePattern.getKey(), initValueConfig);
    }
    return mapBuilder.build();
}
Also used : InitValueConfig(com.google.api.codegen.metacode.InitValueConfig) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap) HashMap(java.util.HashMap) ImmutableMap(com.google.common.collect.ImmutableMap) SingleResourceNameConfig(com.google.api.codegen.config.SingleResourceNameConfig)

Aggregations

SingleResourceNameConfig (com.google.api.codegen.config.SingleResourceNameConfig)16 ArrayList (java.util.ArrayList)9 FieldConfig (com.google.api.codegen.config.FieldConfig)4 InterfaceConfig (com.google.api.codegen.config.InterfaceConfig)4 ResourceNameOneofConfig (com.google.api.codegen.config.ResourceNameOneofConfig)4 FixedResourceNameConfig (com.google.api.codegen.config.FixedResourceNameConfig)3 MethodConfig (com.google.api.codegen.config.MethodConfig)3 ResourceNameConfig (com.google.api.codegen.config.ResourceNameConfig)3 DiscoveryMethodModel (com.google.api.codegen.config.DiscoveryMethodModel)2 FieldModel (com.google.api.codegen.config.FieldModel)2 MethodContext (com.google.api.codegen.config.MethodContext)2 Method (com.google.api.codegen.discovery.Method)2 HashMap (java.util.HashMap)2 DiscoGapicInterfaceConfig (com.google.api.codegen.config.DiscoGapicInterfaceConfig)1 DiscoGapicInterfaceContext (com.google.api.codegen.config.DiscoGapicInterfaceContext)1 GapicMethodContext (com.google.api.codegen.config.GapicMethodContext)1 InterfaceContext (com.google.api.codegen.config.InterfaceContext)1 InterfaceModel (com.google.api.codegen.config.InterfaceModel)1 MethodModel (com.google.api.codegen.config.MethodModel)1 PageStreamingConfig (com.google.api.codegen.config.PageStreamingConfig)1