常用的设计模式类图
2019-12-25 10:37:19 2 举报
常用的设计模式类图
作者其他创作
大纲/内容
AbstractClass
+ templateMethod()# subMethod()
<<interface>>Handler
+ handleRequest()
<<Abstract>>Decorator
# wrappedComponent : Component
+ methodA()+ methodB()
ConcreteCreator
+ createProduct()
Client
<<interface>>Adapter
+ operation()
Receiver
+ action()
<<interface>>AbstractFactory
+ createProduct1()+ createProduct2()
ConcretetFactory2
ConcreteClass
+ subMethod()
ConcreteDecorator2
ConcreteSubject
+ observers : List<Observer>
+ registerObserver(Observer o)+ removeObserver(Observer o)+ notifyObservers()+ getState()+ setState()
模板方法模式
Adaptee
+ apdaptedOperation()
Observable
- obs : Vector<Observer>
+ addObserver(Observer o)+ deleteObserver(Observer o)+ notifyObservers()+ setChanged()
<<interface>>Subject
+ request()
ConcreteVistor
+ visit(ConcreteElement1 e)+ visit(ConcreteElement2 e)
RealSubject
装饰器模式
<<interface>>Component
+ operation()+ add(Component c)+ remove(Component c)+ getChild(int i)
ConcreteHandler2
Singleton
- static uniqueInstance : Singleton
+ static getInstance()
Director
+ construct(Builder builder)
ConcreteProduct2
ConcreteAdapter
- adaptee : Adaptee
<<interface>>Vistor
<<interface>>Strategy
+ execute()
建造者模式
责任链模式
访问者模式
ConcreteElement2
+ accept(Vistor v)
ComplexProduct
- productPart1 : ProductPart1- productPart2 : ProductPart2
单例模式
<<interface>>Product2
观察者模式
<<interface>>Creator
<<interface>>Product
ConcreteObserver
+ update(Subject s)
JDK观察者模式
ConcreteStrategy2
<<interface>>Product1
Product11
public void execute() { receiver.action()}
JDK动态代理模式
<<interface>>InvocationHandler
+ invoke()
组合模式
Proxy
RealSubjectInvocationHandler
- subject: RealSubject
ConcretetFactory1
<<interface>>Observer
ConcreteProduct1
ConcreteCommand
+ receiver : Receiver
+ execute()+ undo()
Product22
桥接模式
ConcreteProduct
ConcreteStrategy1
ConcreteDecorator1
Product21
<<interface>>Element
命令模式
Composite
- components : List<Component>
AbstractHandler
# nextHandler:AbstractHandler
简单工厂模式
ConcreteElement1
ConcreteHandler1
<<interface>>Implementor
+ operationImp()
Context
Leaf
工厂方法模式
ConcreteBuilder
- product : ComplexProduct
+ buildPart1()+ buildPart2()+ build()
+ registerObserver(Observer o)+ removeObserver(Observer o)+ notifyObservers()
Product12
ConcreteComponent
<<interface>>Builder
+ buildPart1()+ buildPart2()
ConcreteObservable
- subject : RealSubject
代理模式
ConcreteImplementor1
抽象工厂模式
+operation()
策略模式
Invoker
+ setCommand()
ConcreteImplementor2
适配器模式
SimpleFactory
<<interface>>Command
# implementor : Implementor
0 条评论
下一页