@Override public boolean hasBatchingMethods() { for (MethodConfig methodConfig : getMethodConfigs()) { if (methodConfig.isBatching()) { return true; } } return false; }
@Override public boolean hasReroutedInterfaceMethods() { for (MethodConfig methodConfig : getMethodConfigs()) { if (!Strings.isNullOrEmpty(methodConfig.getRerouteToGrpcInterface())) { return true; } } return false; } }
@Override public boolean hasPageStreamingMethods() { for (MethodConfig methodConfig : getMethodConfigs()) { if (methodConfig.isPageStreaming()) { return true; } } return false; }
private boolean hasUnaryUnary(GapicInterfaceConfig interfaceConfig) { return interfaceConfig .getMethodConfigs() .stream() .anyMatch(method -> !method.isGrpcStreaming()); }
@Override public boolean hasGrpcStreamingMethods() { for (MethodConfig methodConfig : getMethodConfigs()) { if (methodConfig.isGrpcStreaming()) { return true; } } return false; }
@Override public boolean hasLongRunningOperations() { for (MethodConfig methodConfig : getMethodConfigs()) { if (methodConfig.isLongRunningOperation()) { return true; } } return false; }
private boolean hasRequestHeaderParams(GapicInterfaceContext context) { return context .getInterfaceConfig() .getMethodConfigs() .stream() .anyMatch(config -> config.getHeaderRequestParams().iterator().hasNext()); }
/** Returns a list of supported methods, configured by FeatureConfig. */ @Override public List<MethodModel> getSupportedMethods() { List<MethodModel> methods = new ArrayList<>(getInterfaceConfig().getMethodConfigs().size()); for (MethodModel methodModel : getInterfaceConfigMethods()) { if (isSupported(methodModel)) { methods.add(methodModel); } } return methods; }
/** Returns a list of methods for this interface that have method configs. Memoize the result. */ @Override public List<MethodModel> getInterfaceConfigMethods() { if (interfaceMethods != null) { return interfaceMethods; } ImmutableList.Builder<MethodModel> methodBuilder = ImmutableList.builder(); for (MethodConfig methodConfig : getInterfaceConfig().getMethodConfigs()) { methodBuilder.add(new ProtoMethodModel(((GapicMethodConfig) methodConfig).getMethod())); } interfaceMethods = methodBuilder.build(); return interfaceMethods; }
private boolean hasStreamingUnary(GapicInterfaceConfig interfaceConfig) { return interfaceConfig .getMethodConfigs() .stream() .anyMatch( method -> method.isGrpcStreaming() && method.getGrpcStreaming().getType() == GrpcStreamingConfig.GrpcStreamingType.ClientStreaming); }
@Override public boolean hasGrpcStreamingMethods(GrpcStreamingConfig.GrpcStreamingType streamingType) { for (GapicMethodConfig methodConfig : getMethodConfigs()) { if (methodConfig.isGrpcStreaming() && methodConfig.getGrpcStreamingType() == streamingType) { return true; } } return false; }
private boolean hasStreamingStreaming(GapicInterfaceConfig interfaceConfig) { return interfaceConfig .getMethodConfigs() .stream() .anyMatch( method -> method.isGrpcStreaming() && method.getGrpcStreaming().getType() == GrpcStreamingConfig.GrpcStreamingType.BidiStreaming); }
private boolean hasUnaryStreaming(GapicInterfaceConfig interfaceConfig) { return interfaceConfig .getMethodConfigs() .stream() .anyMatch( method -> method.isGrpcStreaming() && method.getGrpcStreaming().getType() == GrpcStreamingConfig.GrpcStreamingType.ServerStreaming); }
/** * Returns a list of RPC methods supported by the context, taking into account GRPC interface * rerouting. TODO replace getSupportedMethods with this when all languages are migrated. */ public List<Method> getSupportedMethodsV2(Interface apiInterface) { GapicInterfaceConfig interfaceConfig = getApiConfig().getInterfaceConfig(apiInterface); if (interfaceConfig == null) { throw new IllegalStateException( "Service not configured in GAPIC config: " + apiInterface.getFullName()); } List<Method> methods = new ArrayList<>(interfaceConfig.getMethodConfigs().size()); for (MethodConfig methodConfig : interfaceConfig.getMethodConfigs()) { Method method = ((GapicMethodConfig) methodConfig).getMethod(); if (isSupported(method)) { methods.add(method); } } return methods; }
/** * Returns a list of methods with samples, similar to getSupportedMethods, but also filter out * private methods. */ @Override public List<MethodModel> getPublicMethods() { List<MethodModel> methods = new ArrayList<>(getInterfaceConfig().getMethodConfigs().size()); for (MethodModel method : getInterfaceConfigMethods()) { VisibilityConfig visibility = getInterfaceConfig().getMethodConfig(method).getVisibility(); if (isSupported(method) && visibility == VisibilityConfig.PUBLIC) { methods.add(method); } } return methods; }