Adding strongly-typed call and server Options
MultiPart: 1/3
Change-Id: I0fc8341aff1a5cfe9863591bbddf6177db11e76d
diff --git a/lib/vdl/codegen/java/file_client_impl.go b/lib/vdl/codegen/java/file_client_impl.go
index 6cb2e7f..2561766 100644
--- a/lib/vdl/codegen/java/file_client_impl.go
+++ b/lib/vdl/codegen/java/file_client_impl.go
@@ -60,10 +60,18 @@
{{/* The optionless overload simply calls the overload with options */}}
@Override
public {{ $method.RetType }} {{ $method.Name }}(io.v.v23.context.VContext _context{{ $method.DeclarationArgs }}) {
- return {{ $method.Name }}(_context{{ $method.CallingArgsLeadingComma }}, null);
+ return {{ $method.Name }}(_context{{ $method.CallingArgsLeadingComma }}, (io.v.v23.options.RpcOptions)null);
}
+
+ {{/* Overload taking deprecated legacy options */}}
+ @Deprecated
@Override
public {{ $method.RetType }} {{ $method.Name }}(final io.v.v23.context.VContext _context{{ $method.DeclarationArgs }}, io.v.v23.Options _opts) {
+ return {{ $method.Name }}(_context{{ $method.CallingArgsLeadingComma }}, io.v.v23.options.RpcOptions.migrateOptions(_opts));
+ }
+
+ @Override
+ public {{ $method.RetType }} {{ $method.Name }}(final io.v.v23.context.VContext _context{{ $method.DeclarationArgs }}, io.v.v23.options.RpcOptions _opts) {
{{/* Start the vanadium call */}}
// Start the call.
java.lang.Object[] _args = new java.lang.Object[]{ {{ $method.CallingArgs }} };
@@ -183,11 +191,18 @@
{{/* e.g. return this.implArith.cosine(context, [args]) */}}
return this.impl{{ $eMethod.IfaceName }}.{{ $eMethod.Name }}(_context{{ $eMethod.CallingArgsLeadingComma }});
}
+ {{/* Overload taking deprecated legacy options */}}
+ @Deprecated
@Override
public {{ $eMethod.RetType }} {{ $eMethod.Name }}(io.v.v23.context.VContext _context{{ $eMethod.DeclarationArgs }}, io.v.v23.Options _opts) {
{{/* e.g. return this.implArith.cosine(_context, [args], options) */}}
return this.impl{{ $eMethod.IfaceName }}.{{ $eMethod.Name }}(_context{{ $eMethod.CallingArgsLeadingComma }}, _opts);
}
+ @Override
+ public {{ $eMethod.RetType }} {{ $eMethod.Name }}(io.v.v23.context.VContext _context{{ $eMethod.DeclarationArgs }}, io.v.v23.options.RpcOptions _opts) {
+ {{/* e.g. return this.implArith.cosine(_context, [args], options) */}}
+ return this.impl{{ $eMethod.IfaceName }}.{{ $eMethod.Name }}(_context{{ $eMethod.CallingArgsLeadingComma }}, _opts);
+ }
{{ end }}
}
`
diff --git a/lib/vdl/codegen/java/file_client_interface.go b/lib/vdl/codegen/java/file_client_interface.go
index bb9274b..165621d 100644
--- a/lib/vdl/codegen/java/file_client_interface.go
+++ b/lib/vdl/codegen/java/file_client_interface.go
@@ -45,7 +45,14 @@
{{ if $method.NonStreaming }}
@javax.annotation.CheckReturnValue
{{ end }} {{/* end if $method.NonStreaming */}}
+ @java.lang.Deprecated
{{ $method.RetType }} {{ $method.Name }}(io.v.v23.context.VContext context{{ $method.Args }}, io.v.v23.Options opts);
+
+ {{ $method.Doc }}
+ {{ if $method.NonStreaming }}
+ @javax.annotation.CheckReturnValue
+ {{ end }} {{/* end if $method.NonStreaming */}}
+ {{ $method.RetType }} {{ $method.Name }}(io.v.v23.context.VContext context{{ $method.Args }}, io.v.v23.options.RpcOptions opts);
{{ end }}
}
`