java设计模式uml类图
2021-04-03 14:35:27 80 举报
Java设计模式上路必备 设计模式demo类图汇总,源码及笔记起始地址:https://blog.csdn.net/qq_41026669/article/details/111798703 免费的赞点一个再走呗
作者其他创作
大纲/内容
ConcreteWebSite
type:String
ConcreteWebSite(String)
抽象工厂
College
organizationComponents:List<OrganizationComponent>
组合模式
Calculator
expression:Expression
1
Duck
flyBehavior:FlyBehavior
quack():voidswim():voidfly():voidabstract void display()
LightReceiver
on():voidoff():void
Voltage220V
output220V:int
CommonHouse
CollegeApprover
CollegeApprover(String)
Mediator
2
建造者模式
Department
create
Voltage5V
output5V():int
InfoColleage
departmentList:List<Department>
WeatherData
temperature:floatpressure:floathumidity:floatobservers:ArrayList<Observer>
XiaoMi
LDPepperPizza
Action
getManResult(Man):voidgetWomanResult(Woman):void
BaiduSite
temperature:floatpressure:floathumidity:float
类适配器
Colleague
mediator:Mediatorname:String
JDK自带接口
Vivo
接口适配器
SoyaMilk
abstract void addCondiments()其他步骤final void make()
Chocolate
Chocolate(Drink)
状态模式
LDCheesePizza
PepperPizza
Alarm
SendAlarm(int):void
Screen
instance:Screen
工厂方法
CanRaffleState
activity:RaffleActivity
CanRaffleState(RaffleActivity)
单例模式
Milk
Milk(Drink)
原型模式
RaffleActivity
state:Statecount:intnoRaffleState:StatecanRaffleState:StatedispenseState:StatedispenseOutState:State
RaffleActivity(int)
HouseBuilder
house:House
TeacherDao
teach():void
PennutSoyaMilk
addCondiments():void
ToyDuck
GoodFlyBehavior
Iterator
abstract boolean hasNext()|abstract E next()|remove():voidforEachRemaining(Consumer<? super E>):void
Observer
Phone
charging(Voltage):void
TVReceiver
JDK代理
HomeTheaterFacade
dvdPlayer:DVDPlayerpopcorn:Popcornprojector:Projectorscreen:Screen
HomeTheaterFacade()
BJPepperPizza
ViceSchoolMasterApprover
ViceSchoolMasterApprover(String)
Approver
approver:Approvername:String
Approver(String)setApprover(String)abstract void processRequest(PurchaseRequest)
name:Stringdesc:String
BJOrderPizza
Coffee
Cglib代理
NoRaffleState
NoRaffleState(RaffleActivity)
Pizza
name:String
Expression
WoMan
ProxyFactory
target:Object
ProxyFactory(Object)getProxyInstance():Object
SymbolExpression
left:Expressionright:Expression
观察者模式
ShortBlack
策略模式
享元模式
CurrentConditions
ITeacherDao
OutputImpl
colleageList:List<Colleage>
brand:Brand
Phone(Brand)open():voidclose():voidcall():void
PurchaseRequest
type:intprice:floatid:int
User
User(String)
CoffeeMachine
startCoffee():voidfinishCoffee:void
TV
startTV():voidstopTV():void
迭代器模式
BJCheesePizza
TVOnCommand
tv:TVReceiver
TVOnCommand(TVReceiver)
TVOffCommand
TVOffCommand(TVReceiver)
NoCommand
Voltage
可能用到的要适配的方法
InfoColleageIterator
departmentList:List<Department>index:int
InfoColleageIterator(List<Department>)
DispenseOutState
DispenseOutState(RaffleActivity)
ObjectStructure
persons:List<Person>
attach(Person):voiddetach(Person):voiddisplay(Person):void
Brand
open():voidclose():voidcall():void
SimpleFactory
解释器模式
装饰者模式
OrganizationComponent
name:Stringdes:String
Man
Command
execute():voidundo():void
Subject
registerObserver(Observer):voidremoveObserver(Observer):voidnotifyObservers():void
Success
DepartmentApprover
DepartmentApprover(String)
University
ComputerColleageIterator
departments:Department[]position:int
ComputerColleageIterator(Department[])
AddExpression
House
base:Stringwall:Stringroofed:String
HighBuilding
中介者模式
LDFactory
备忘录模式
Caretaker
memento:Memento
get、set
Espresso
LightOnCommand
light:LightReceiver
LightOnCommand(LightReceiver)
Curtains
upCurtains:void
OrderPizza
simpleFactory:SimpleFactorypizza:Pizza
OrderPizza(SimpleFactory )
Popcorn
instance:Popcorn
Decorator
obj:Drink
Decorator(Drink)
TeacherDaoProxy
target:ITeacherDao
TeacherDaoProxy(ITeacherDao)teach():void
外观模式
SchoolMasterApprover
SchoolMasterApprover(String)
ConcreteMediator
调用并重写需要适配的方法
OrderPizza()abstract Pizza createPizza(String)
命令模式
BadFlyBehavior
Colleage
GameRole
vit:intdef:int
display():voidcreateMemento():Mementoget、set
FoldedPhone
FoldedPhone(Brand)
CheesePizza
WebSiteFactory
getWebSiteCategory(String):WebSitegetWebSiteCount():int
对象适配器
MethodInterceptor
BJFactory
GreekPizza
Memento
DVDPlayer
instance:DVDPlayer
DVDPlayer()
WebSite
use(User):void
Fail
LDOrderPizza
RemoteController
onCommands:Commands[]offCommands:Commands[]undoCommand:Command
VoltageAdapter
voltage220v:Voltage220V
VoltageAdapter(Voltage220V)
静态代理
适配方法空实现或默认实现
Projector
instance:Projector
样式、品牌组合
VarExpression
key:String
VarExpression(String)
PekingDuck
FlyBehavior
fly():void
模板方法
DispenseState
DispenseState(RaffleActivity)
LightOffCommand
LightOffCommand(LightReceiver)
UpRightPhone
SubExpression
职责链模式
NoFlyBehavior
State
deduceMoney():voidraffle():booleandispensePrize():void
AbsFactory
createPizza(String)
Person
accept(Action):void
桥接模式
factory:AbsFactory
OrderPizza(AbsFactory)
ComputerColleage
departments:Department[]numOfDepartment:int
LongBlack
HouseDirector
houseBuilder:HouseBuilder
HouseDirector(HouseBuilder)
WildDuck
PureSoyaMilk
访问者模式
Soy
Soy(Drink)
Drink
price:floatdes:String
Drink()abstract float cost()
简单工厂
BlackBeanSoyaMilk
0 条评论
下一页
为你推荐
查看更多