Answer the question
In order to leave comments, you need to log in
How to get values from sheets from a non-public class?
Good evening ! I would like to add roles and rights to the authorities variable, but I haven’t made friends with streamers yet, but I need it now :(. Could you help?
The class from which you need to get data:
UserDetails which maps data to
authorities but they are in the default class)
Answer the question
In order to leave comments, you need to log in
Your problem (apart from the boundless love of screenshots) is that you are trying to create a stream from heterogeneous objects, from a string and two lists.
Options:
Wrap a string in a sheet:
return Stream.of(assetTemplateIds,
taskTemplatesIds,
List.of(name)).flatMap(SimpleGrantedAuthority::new)
.collect(Collectors.toList());
var templatesIds = Stream.concat(
assetTemplateIds.stream(),
taskTemplatesIds.stream()
);
return Stream.concat(
templatesIds,
Stream.of(name)
).map(SimpleGrantedAuthority::new)
.collect(Collectors.toList());
Do you want to get something like this?
List<String> assetTemplateIds = rights.stream().flatMap(rightsList -> rightsList.getAssetTemplateIds().stream()).collect(Collectors.toList());
List<String> taskTemplatesIds = rights.stream().flatMap(taskTemplatesList -> taskTemplatesList.getTaskTemplatesIds().stream()).collect(Collectors.toList());
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question