On 05-Aug-16 18:42, Gale Naylor wrote:
Hello Gale
In CwlContextualView.java (I used the wrong filename in my previous email)
I'm also curious about the two private, final (but not static) constants
(?): configurationBean and activity.
I'm not sure this StackOverflow answer is 100% relevant because
configurationBean and activity do not have initial values, but this is all
I've been able to find online:
http://stackoverflow.com/questions/1415955/private-final-static-attribute-vs-private-final-attribute
If an attribute is not static then each instance of the class has its
own attribute. So,
private final CwlActivityConfigurationBean configurationBean;
means that each CwlContextualView has its own configurationBean value.
If an attribute is declared as static, then all instances of the class
share the same attribute value.
The private means that the value of the configurationBean cannot be
accessed (directly) outside of the CwlContextualView. So
fred = myCwlContextualView.configurationBean // will not work
The final means that once the attribute has a value it cannot be
changed. Even stronger, the value must be specified either in the
declaration of the attribute, or when you construct an instance of
CwlContextualView. (There are weird exceptions to the last sentence that
are best ignored and never mentioned in polite company.)
If you look at
public CwlContextualView(CwlDumyActivity activity)
which makes a CwlContextualView, it contains the line:
this.configurationBean = activity.getConfiguration();
So once you have made a CwlConfigurationView, it has a configurationBean
attribute, that nothing else can see, and that has a fixed value.
Can anyone point me to information that would help me understand this
nomenclature?
I think
http://stackoverflow.com/questions/13772827/difference-between-static-and-final
explains static and final well.
Thanks,
Gale
Alan