Static Class Structure
Client
Flyweight interface.
flyweight)
to a Flyweight object.
Flyweight operation
(operation(extrinsicState)).
Flyweight object from
the FlyweightFactory
(by invoking getFlyweight(key)).
Flyweight
operation(extrinsicState))
through which extrinsic (variant) state
can be passed in.
Flyweight1,…
Flyweight interface.
UnsharedFlyweight1,…
Flyweight interface
but are not shared.
FlyweightFactory
Flyweight objects
(flyweight pool).
Flyweight object
if it doesn't exist and
shares (reuses) an existing one.
Dynamic Object Collaboration
Client object
shares
a Flyweight1 object
by requesting it from a FlyweightFactory
object.
Client that calls
getFlyweight(key) on the
FlyweightFactory.
FlyweightFactory
creates
a Flyweight1 object
and returns it
to the Client.
Client
calls operation(extrinsicState)
on the returned Flyweight1 object
by passing in the
extrinsic state.
Client again
calls getFlyweight(key)
on the
FlyweightFactory.
FlyweightFactory
shares (reuses)
the Flyweight1 object.
Client
calls operation(extrinsicState)
on the returned Flyweight1 object.