-
Notifications
You must be signed in to change notification settings - Fork 426
Home
Werner Kunze edited this page Apr 11, 2022
·
12 revisions
The following will only allow to call procedures that take positional arguments (only), and return nothing or a single positional result.
However, for such situations, it provides full POJO auto-mapping.
public <T> CompletableFuture<T> call(String procedure,
TypeReference<T> resultType,
CallOptions options,
Object... args)
public <T> CompletableFuture<T> call(String procedure,
List<Object> args,
Map<String, Object> kwargs,
TypeReference<T> resultType,
CallOptions options)
-
com.example.get_person
: returns a single positional result (args[0]
) of "complex type Person".
TypeReference resultType = new TypeReference<Person>() {};
session.call("com.example.get_person", null, null, resultType, null);
-
com.example.get_persons
: returns a single positional result (args[0]
), which is a list of object of "complex type Person"
TypeReference resultType = new TypeReference<List<Person>>() {};
session.call("com.example.get_persons", null, null, resultType, null);
-
com.example.get_persons_by_department
: returns a single positional result (args[0]
), which is a map of strings (department name) to lists of complex objects of type Person
TypeReference resultType = new TypeReference<Map<String, List<Person>>>() {};
session.call("com.example.get_persons_by_department", null, null, resultType, null);
public <T1, T2> CompletableFuture<TupleOf2<T1, T2>> call(
String procedure,
List<Object> args,
Map<String, Object> kwargs,
TupleOf2<TypeReference<T1>, TypeReference<T2>> resultTypes,
CallOptions options)
public <T1, T2, T3> CompletableFuture<TupleOf3<T1, T2, T3>> call(
String procedure,
List<Object> args,
Map<String, Object> kwargs,
TupleOf3<TypeReference<T1>, TypeReference<T2>, TypeReference<T3>> resultTypes,
CallOptions options)
and so forth. gets boring.
-
com.example.get_foo
: returns a 3-positional result (args[0:2]
), with the first two being of type float, and the last one being of complex type Person
TupleOf3<TypeReference<Float>,
TypeReference<Float>,
TypeReference<Person>> resultTypes = new ???;
session.call("com.example.get_foo", null, null, resultTypes, null);
This would return a CompletableFuture<TupleOf3<Float, Float, Person>>
.