首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > Java > 易写空安全表达式

易写空安全表达式

资 源 简 介

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

相 关 资 源

您 可 能 感 兴 趣 的

同 类 别 推 荐

VIP VIP