내 코드에는 API에서 데이터를 가져 오는 메소드가 있습니다.Nro Safety에 적합한 Retrofit의 onResponse 방법에서 @NonNull을 사용하고 있습니까?
public void getInitResponse() {
apiService.getInitResponse().enqueue(new Callback<InitGet>() {
@Override
public void onResponse(@NonNull Call<InitGet> call, @NonNull Response<InitGet> response) {
if (response.isSuccessful()) {
String aesKeyEncrypted = response.body().getAsKy();
String aesIvEncrypted = response.body().getAsIv();
}
}
}
getAsKy 또는 getAsIv 메소드는 null을 반환 할 수 있습니다. 이 경우에는 @NonNull Call<InitGet> call
이 좋은 해결책입니까? 또는 if-else를 사용하여 널 포인터 예외를 얻지 못하는 간단한 널 (null) 검사를 수행해야합니까?