This content has been marked as final. Show 2 replies
The terminology confusion here is my fault. Do you want to declare a read only property or an immutable (constant) property? For immutable properties we simply provide a final getter, no setter, and no property method (see LinearGradient for example).1 person found this helpful
For a read only property (which is read only to the world, but privately or protectedly writable), Version 2 is the correct pattern for the reason you described.
With regard to the "constant properties", I was looking for a bindable replacement for public static final variables. Maybe I should have said "bindable constants" because I don't really use a property pattern.
For example, I replaced:
public static final double LIMIT_HIGH = 240;
I haven't seen anyone else do this, but I figured this might be the way to do it, based on the read-only property pattern. Am I correct, or is there a better way to achieve the same results ?
public static final ReadOnlyDoubleProperty LIMIT_HIGH = new ReadOnlyDoubleWrapper(240).getReadOnlyProperty();