Skip to content

Commit afd7922

Browse files
committed
fix: make parameters and results not nullable in endpoint
1 parent fe487c9 commit afd7922

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/main/java/com/flowingcode/addons/applayout/endpoint/MenuEndpoint.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.flowingcode.addons.applayout.MenuItem;
66
import com.vaadin.flow.server.auth.AnonymousAllowed;
77
import com.vaadin.fusion.Endpoint;
8+
import com.vaadin.fusion.Nonnull;
89

910
@Endpoint
1011
@AnonymousAllowed
@@ -16,7 +17,7 @@ public MenuEndpoint(List<MenuItemsProvider> menuItemsProviders) {
1617
this.menuItemsProviders = menuItemsProviders;
1718
}
1819

19-
public List<MenuItemDto> getMenuItems() {
20+
public @Nonnull List<@Nonnull MenuItemDto> getMenuItems() {
2021
List<MenuItem> menuItems = menuItemsProviders.stream().map(MenuItemsProvider::getMenuItems).flatMap(List::stream).collect(Collectors.toList());
2122
return convertMenuItems(menuItems);
2223
}

src/main/java/com/flowingcode/addons/applayout/endpoint/MenuItemDto.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
import java.util.ArrayList;
44
import java.util.List;
5-
65
import javax.annotation.Nullable;
6+
import com.vaadin.fusion.Nonnull;
77

88
public class MenuItemDto {
99

1010
private String label;
1111
@Nullable
1212
private String href;
13-
private List<MenuItemDto> children = new ArrayList<>();
13+
private @Nonnull List<@Nonnull MenuItemDto> children = new ArrayList<>();
1414

1515
public MenuItemDto(String label, List<MenuItemDto> children) {
1616
this(label,null,children);
@@ -40,10 +40,10 @@ public String getLabel() {
4040
public String getHref() {
4141
return href;
4242
}
43-
public void setHref(String href) {
43+
public void setHref(@Nonnull String href) {
4444
this.href = href;
4545
}
46-
public void setLabel(String label) {
46+
public void setLabel(@Nonnull String label) {
4747
this.label = label;
4848
}
4949

0 commit comments

Comments
 (0)