use of com.google.api.gax.httpjson.ApiMethodDescriptor.MethodType in project gapic-generator-java by googleapis.
the class HttpJsonServiceStubClassComposer method getMethodTypeExpr.
private List<Expr> getMethodTypeExpr(Method protoMethod) {
MethodType methodType;
switch(protoMethod.stream()) {
case NONE:
methodType = MethodType.UNARY;
break;
case SERVER:
methodType = MethodType.SERVER_STREAMING;
break;
case CLIENT:
// Not feasible to suppor in REST
case BIDI:
// Not feasible to suppor in REST
default:
throw new UnsupportedOperationException(String.format("Methods of type %s are not supported by REST transport", protoMethod.stream()));
}
EnumRefExpr expr = EnumRefExpr.builder().setName(methodType.toString()).setType(TypeNode.withReference(ConcreteReference.builder().setClazz(ApiMethodDescriptor.MethodType.class).build())).build();
return Collections.singletonList(expr);
}
Aggregations