A
A
avgona_pl2021-06-09 22:52:21
Java
avgona_pl, 2021-06-09 22:52:21

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:
60c1209523cba698664432.png

UserDetails which maps data to
60c120a8cfe75313160855.png

authorities but they are in the default class)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Roo, 2021-06-10
@xez

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());

Or, to add streams, use Stream.concat:
var templatesIds = Stream.concat(
                assetTemplateIds.stream(),
                taskTemplatesIds.stream()
        );
        
       return Stream.concat(
                templatesIds,
                Stream.of(name)
        ).map(SimpleGrantedAuthority::new)
                .collect(Collectors.toList());

O
Orkhan, 2021-06-09
Hasanly @azerphoenix

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 question

Ask a Question

731 491 924 answers to any question