-
Notifications
You must be signed in to change notification settings - Fork 426
Home
Tobias Oberstein edited this page Jun 28, 2017
·
12 revisions
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>> 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_position
: returns a 3-positional result (args[0:2]
), with each element of type float -
com.example.get_kw_position
: returns a keywork-based resultkwargs['x'], kwargs['y'], kwargs['z']
with each being a float
TypeReference result_type = new TypeReference<List<Integer>>() {};
session.call("com.example.get_person", null, null, new TypeReference<Person>, null);
List<TypeReference> result_args_types = new ArrayList<>();
result_args_types.add(new TypeReference<Float>() {});
result_args_types.add(new TypeReference<Float>() {});
result_args_types.add(new TypeReference<Float>() {});
session.call("com.example.get_person", null, null, result_args_types, null, null);