Is it feasible to create a NullObject for every class? ( with a tool of course )
The NullObjectPattern is intended to be a "safe" ( neutral ) behavior. The idea is create an object that don't do anything ( but doesn't throw NullPointerException either ) For instance the class defined as: class Employee { private String name; private int age; public String getName(){ return name; } public int getAge() { return age; } } Would cause a NullPointerException in this code: class Other { Employee oscar; String theName = oscar.getName(); // NPE } What the NOP says, is you can have an object like this: class NullEmployee extends Employee { public static final Employee instance = new