March 2002
Intermediate to advanced
496 pages
8h 51m
English
To provide for the sharing of flyweight objects, you need a class with a method other than a constructor that returns the object to be shared. This lets you control flyweight creation, ensuring that only one instance of any particular flyweight exists. There is an example of a flyweight factory in a Swing class that is a factory for Swing components. This class comment says, “wherever possible, this factory will hand out references to shared ... instances.” We used this class in Chapter 4, Facade, and in Chapter 9, Observer.
|
Read now
Unlock full access