@Override public ProtoInterfaceModel getTargetInterface() { return new ProtoInterfaceModel( GapicInterfaceConfig.getTargetInterface( getInterface(), getMethodConfig().getRerouteToGrpcInterface())); }
/** Find the methods that should be generated on the surface when a GAPIC config was given. */ @Nullable private static ImmutableMap<Method, MethodConfigProto> findMethodsToGenerateWithConfigYaml( Interface apiInterface, InterfaceConfigProto interfaceConfigProto, DiagCollector diagCollector) { ImmutableMap.Builder<Method, MethodConfigProto> methodsToSurface = ImmutableMap.builder(); // Get the set of methods defined by the GAPIC config. Only these methods will be generated. for (MethodConfigProto methodConfigProto : interfaceConfigProto.getMethodsList()) { Interface targetInterface = GapicInterfaceConfig.getTargetInterface( apiInterface, methodConfigProto.getRerouteToGrpcInterface()); Method protoMethod = targetInterface.lookupMethod(methodConfigProto.getName()); if (protoMethod == null) { diagCollector.addDiag( Diag.error( SimpleLocation.TOPLEVEL, "method not found: %s", methodConfigProto.getName())); continue; } methodsToSurface.put(protoMethod, methodConfigProto); } if (diagCollector.getErrorCount() > 0) { return null; } return methodsToSurface.build(); }