资 源 简 介
One of the most commonly encountered exception in java is NullPointerException.....avoiding this is very easy, simply add null checks but this adds more complexity and less readability.
Ex: To check whether a student residing country is America you have to write something like
String countryName = student.getAddress().getCountry().getName();
But this is not safe...to make it safe you should write some think like below
if(student != null && student.getAddress() != null && student.getAddress().getCountry() != null && student.getAddress().getCountry().getName() != null) { String countryName = student.getAddress().getCountry().getName();}
Instead of writing such cumbersome conditions with this framework you can write something like
String countryName = safe(obj(student).getAddress().getCountry().getName());
NOTE: Since the cu