public interface LazyInitChild
null.See following example:
interface Address extends LazyInitChild {
String getCity();
void setCity(String c);
}
interface Customer extends LazyInitParent {
Address getAddress();
void setAddress(Address a);
}
void changeCity(String city) {
Customer customer = ...;
// Now here comes the code with the potential null pointer that is prevented by the
// LazyInitXXX interfaces. If the customer does not yet own an Address object
// a new Address instance is created on the fly.
customer.getAddress().setCity(city);
}
To have precise control over instance creation the logic is split into two
interfaces:
LazyInitChild for the bean type that might be created on demand
andLazyInitParent for the bean type that is referencing the child
and whose getter calls are intercepted and checked for potential null
returns.LazyInit which is
a combination of LazyInitChild and LazyInitParent.
LazyInitChild are always created with the same bean factory as their
LazyInitParents. That of course means that their bean style needs to
match.