سؤال

Having this bean structure

class User {
    private List<Permission> permissions;
    ...
}

class Permission {
    private Detail detail;
    ...
}

class Detail {
    private String name;
    ...
}

How can I filter list of users to contain only users with at least one permission with Permission.Detail.name containing string "abc"?

هل كانت مفيدة؟

المحلول

Ok, I found it

select(
        values,
        having(
                on(User.class).gePpermissions(), 
                hasItem(
                        having(
                                on(Permission.class).getDetail().getName(), 
                                containsString("abc")
                        )
                )
        )
);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top