File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
src/main/java/com/flowingcode/vaadin/addons/googlemaps Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 33import elemental .json .Json ;
44import elemental .json .JsonObject ;
55import lombok .Getter ;
6+ import lombok .NonNull ;
67import lombok .Setter ;
78
9+ import java .util .Objects ;
810import java .util .Optional ;
911
1012/**
1416@ Setter
1517public class MarkerLabel {
1618 /**
17- * The text to be displayed in the label.
19+ * The text to be displayed in the label. Required field.
1820 */
21+ @ NonNull
1922 private String text ;
2023
2124 /**
@@ -56,18 +59,18 @@ be used to change the position nor orientation of the label (e.g. using
5659
5760
5861 public MarkerLabel (String text ) {
59- this .text = text ;
62+ this .text = Objects . requireNonNull ( text , "Text cannot be null" ) ;
6063 }
6164
6265 public MarkerLabel (String text , String color , String fontSize ) {
63- this .text = text ;
66+ this .text = Objects . requireNonNull ( text , "Text cannot be null" ) ;
6467 this .color = color ;
6568 this .fontSize = fontSize ;
6669 }
6770
6871 protected JsonObject getJson () {
6972 JsonObject js = Json .createObject ();
70- Optional .ofNullable (getText ()).ifPresent (value -> js .put ("text" , value ));
73+ Optional .of (getText ()).ifPresent (value -> js .put ("text" , value ));
7174 Optional .ofNullable (getColor ()).ifPresent (value -> js .put ("color" , value ));
7275 Optional .ofNullable (getFontFamily ()).ifPresent (value -> js .put ("fontFamily" , value ));
7376 Optional .ofNullable (getFontSize ()).ifPresent (value -> js .put ("fontSize" , value ));
You can’t perform that action at this time.
0 commit comments