Skip to content

Commit

Permalink
Issue #258: Handle Collection and Map types when converting annotated…
Browse files Browse the repository at this point in the history
… properties for GetAll method call
  • Loading branch information
hypfvieh committed May 17, 2024
1 parent fc6506c commit cb77cfc
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ protected PropHandled handleGetAll(ExportedObject _exportObject, final MethodCal
try {
_methodCall.setArgs(new Object[0]);
Object val = invokeMethod(_methodCall, propMeth, object);

// when the value is a collection or map, wrap them in a proper variant type
if (Collection.class.isInstance(val) || (Map.class.isInstance(val))) {
String[] dataType = Marshalling.getDBusType(propEn.getValue().getGenericReturnType());
val = new Variant<>(val, String.join("", dataType));
}

resultMap.put(propEn.getKey().getName(), val);
} catch (Throwable _ex) {
getLogger().debug("Error executing method {} on method call {}", propMeth, _methodCall, _ex);
Expand Down

0 comments on commit cb77cfc

Please sign in to comment.