Search in sources :

Example 6 with BatchingConfig

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

the class BatchingTransformer method generatePartitionKeys.

private List<BatchingPartitionKeyView> generatePartitionKeys(MethodContext context) {
    List<BatchingPartitionKeyView> keys = new ArrayList<>();
    BatchingConfig batching = context.getMethodConfig().getBatching();
    for (GenericFieldSelector fieldSelector : batching.getDiscriminatorFields()) {
        FieldModel selectedType = fieldSelector.getLastField();
        BatchingPartitionKeyView key = BatchingPartitionKeyView.newBuilder().fieldGetFunction(context.getNamer().getFieldGetFunctionName(selectedType)).build();
        keys.add(key);
    }
    return keys;
}
Also used : ArrayList(java.util.ArrayList) BatchingConfig(com.google.api.codegen.config.BatchingConfig) GenericFieldSelector(com.google.api.codegen.config.GenericFieldSelector) BatchingPartitionKeyView(com.google.api.codegen.viewmodel.BatchingPartitionKeyView) FieldModel(com.google.api.codegen.config.FieldModel)

Aggregations

BatchingConfig (com.google.api.codegen.config.BatchingConfig)6 FieldModel (com.google.api.codegen.config.FieldModel)4 ArrayList (java.util.ArrayList)3 GenericFieldSelector (com.google.api.codegen.config.GenericFieldSelector)2 MethodModel (com.google.api.codegen.config.MethodModel)2 GrpcStreamingConfig (com.google.api.codegen.config.GrpcStreamingConfig)1 PageStreamingConfig (com.google.api.codegen.config.PageStreamingConfig)1 InitCodeLineType (com.google.api.codegen.metacode.InitCodeLineType)1 InitCodeNode (com.google.api.codegen.metacode.InitCodeNode)1 BatchingConfigView (com.google.api.codegen.viewmodel.BatchingConfigView)1 BatchingDescriptorClassView (com.google.api.codegen.viewmodel.BatchingDescriptorClassView)1 BatchingDescriptorView (com.google.api.codegen.viewmodel.BatchingDescriptorView)1 BatchingPartitionKeyView (com.google.api.codegen.viewmodel.BatchingPartitionKeyView)1 FieldCopyView (com.google.api.codegen.viewmodel.FieldCopyView)1 ImmutableList (com.google.common.collect.ImmutableList)1