/** Adds a {@link Method} from {@link Operation}. */ private void addMethodFromOperation( Service.Builder serviceBuilder, Operation operation, Path parentPath, String operationType, String path) { TypeInfo responseTypeInfo = getResponseTypeInfo(serviceBuilder, operation); TypeInfo requestType = getRequestTypeInfo( serviceBuilder, operation, parentPath, OpenApiLocations.createOperationLocation(operationType, path)); com.google.protobuf.Method.Builder coreMethodBuilder = com.google.protobuf.Method.newBuilder() .setName(NameConverter.operationIdToMethodName(operation.getOperationId())) .setRequestTypeUrl(requestType.typeUrl()) .setResponseTypeUrl(responseTypeInfo.typeUrl()); if (operation.isDeprecated() != null && operation.isDeprecated()) { coreMethodBuilder.addOptions( createBoolOption( MethodOptions.getDescriptor() .findFieldByNumber(MethodOptions.DEPRECATED_FIELD_NUMBER) .getFullName(), true)); } coreApiBuilder.addMethods(coreMethodBuilder); }
private MethodOptions generateMethodOptions(Method method) { MethodOptions.Builder builder = MethodOptions.newBuilder(); setOptions(builder, method.getOptionsList(), METHOD_OPTION_NAME_PREFIX); return builder.build(); }
/** * Returns a method-level annotation, or null if it is a stream. */ public <T extends Message> T getMethodAnnotation(Extension<MethodOptions, T> extension) { return methodProto.getOptions().getExtension(extension); }
/** * Get the {@code MethodOptions}, defined in {@code descriptor.proto}. */ public MethodOptions getOptions () { return proto.getOptions (); }
public MethodOptions.Builder getMethodOptions() { return currentScope.getMethodOptions(); }
protected MethodOptions.Builder getMethodOptions() { throw new RuntimeException(NOT_APPLICABLE_IN_CURRENT_SCOPE); }
@Override protected MethodOptions.Builder getMethodOptions() { return protoBuilder.getOptionsBuilder(); }
/** * Get the {@code MethodOptions}, defined in {@code descriptor.proto}. */ public MethodOptions getOptions() { return proto.getOptions(); }