I have a class structure like this:
public class Foo { private FooB foob; public Optional getFoob() { return Optional.ofNullable
Why you dont add a getValue methode to the class Foo? This would be a kind of delegation.
getValue
Foo
public class Foo { ... public Integer getValue() { if (foob == null) { return null; } return foob.getValA(); } }