* Fix a division method mistake

* Spring null-safety
This commit is contained in:
nguyennamthai 2018-10-30 04:11:57 +07:00 committed by Grzegorz Piwowarek
parent d7bbfb353d
commit cb1b3d5a5c
2 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,33 @@
package org.baeldung.nullibility;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
public class Person {
@NonNull
private String fullName;
@Nullable
private String nickName;
void setFullName(String fullName) {
if (fullName != null && fullName.isEmpty()) {
fullName = null;
}
this.fullName = fullName;
}
void setNickName(String nickName) {
if (nickName != null && nickName.isEmpty()) {
nickName = null;
}
this.nickName = nickName;
}
String getFullName() {
return fullName;
}
String getNickName() {
return nickName;
}
}

View File

@ -0,0 +1,6 @@
@NonNullApi
@NonNullFields
package org.baeldung.nullibility;
import org.springframework.lang.NonNullApi;
import org.springframework.lang.NonNullFields;