The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

chrismalan (38) [Avatar] Offline
#1
This is the listing:
class DoublerBean {
public value #A
void setValue(value){ #1
this.value = value
}

def getValue(){ #2
value * 2
}

}
def bean = new DoublerBean(value: 100)
assert 200 == bean.value #3
assert 100 == bean.@value #B

#A Visible field
#1 Inner field access
#2 Inner field access
#3 Property access
#B Outer field access


Inner field access sounds like access of an inner field and outer field access sounds like access of an outer field. Clearly, this is not the case.

The explanation in the paragraph preceding the listing is clear.

Either have 'field access from inside/outside the object' - from inside the object it is always through a getter method, even if the call is 'bean.value' as you explain. Maybe a better description will be 'indirect/direct access' where in indirect access the getter method is used, even if the call is 'bean.value' and in direct access the getter is bypassed, as you mentioned, when calling bean.@value.

Why leave some ambiguity when one can put it in such a way it can't be misunderstood?