[prev in list] [next in list] [prev in thread] [next in thread]
List: openjdk-openjfx-dev
Subject: FX-9: strange (?) factory pattern in BehaviorBase:
From: fastegal () swingempire ! de
Date: 2016-03-18 9:56:12
Message-ID: 20160318105612.Horde.PNVZO_ubrrniB1ulm9RoJQ6 () webmail ! df ! eu
[Download RAW message or body]
The implementation of creating/accessing its inputMap looks strange to me:
// no field
// abstract getter
protected abstract InputMap getInputMap();
// implemented factory method
protected InputMap createInputMap() {
return new InputMap(getNode());
}
Now all subclasses (need to) contain the exact same snippets (and we
all know that code duplication is the worst smell of all :)
// have the field
private InputMap myMap;
// set the field in constructor
super(control);
myMap = createInputMap();
// implement getter
protected InputMap getInputMap() {
return myMap;
}
Wondering why the field is defered to subclasses? If it were pulled up
into base, all the duplicated code in subclasses could be deleted.
There must be a reason, but I don't see it - please enlighten me!
Cheers
Jeanette
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic