Can someone help me provide a generic optimized code to test for null objects? What I am basically looking for is a method, that can take any object as input and maybe the path and return a boolean specifying if the target object is null or not.
Something like this:
public boolean isNull(Object Obj, String Path){
// ...
}
Path being something like: A.getB().getC(). . .
so A is passed as object, and the isNull
method first calls getB()
checks if the returned object is not null
then calls getC()
and so forth.