public Page build() { if (key == null || key.isEmpty()) { throw new IllegalArgumentException("Key must not be empty"); } if (name == null || name.isEmpty()) { throw new IllegalArgumentException("Name must be defined and not empty"); } if (qualifiers.length > 0 && !COMPONENT.equals(scope)) { throw new IllegalArgumentException(format("The scope must be '%s' when component qualifiers are provided", COMPONENT)); } if (qualifiers.length == 0 && COMPONENT.equals(scope)) { qualifiers = Qualifier.values(); } return new Page(this); } }
public Page build() { if (key == null || key.isEmpty()) { throw new IllegalArgumentException("Key must not be empty"); } if (name == null || name.isEmpty()) { throw new IllegalArgumentException("Name must be defined and not empty"); } if (qualifiers.length > 0 && !COMPONENT.equals(scope)) { throw new IllegalArgumentException(format("The scope must be '%s' when component qualifiers are provided", COMPONENT)); } if (qualifiers.length == 0 && COMPONENT.equals(scope)) { qualifiers = Qualifier.values(); } return new Page(this); } }
private List<Page> getPages(Scope scope, boolean isAdmin, @Nullable Qualifier qualifier) { return getAllPages().stream() .filter(p -> p.getScope().equals(scope)) .filter(p -> p.isAdmin() == isAdmin) .filter(p -> !COMPONENT.equals(p.getScope()) || p.getComponentQualifiers().contains(qualifier)) .collect(toList()); }
private List<Page> getPages(Scope scope, boolean isAdmin, @Nullable Qualifier qualifier) { return getAllPages().stream() .filter(p -> p.getScope().equals(scope)) .filter(p -> p.isAdmin() == isAdmin) .filter(p -> !COMPONENT.equals(p.getScope()) || p.getComponentQualifiers().contains(qualifier)) .collect(toList()); }