public class A {
    protected String foo;
    public String getFoo() {
        return foo;
    }
    public void setFoo(String newFoo) {
        // complex business logic
        foo = newFoo;
    }
}