当前位置:网站首页>Scala responsibility chain pattern
Scala responsibility chain pattern
2022-06-25 01:03:00 【Jue Niu thunder plough hot blade】
// Scala in , The case where a class inherits more than one trait is called superposition trait
object Responsibility chain pattern {
trait Handler {
def handle(data: String): Unit = {
println(" Process specific data ... 4")
println(data + " 5")
}
}
trait DataValidHandler extends Handler {
override def handle(data: String): Unit = {
println(" Check the data 3")
super.handle(data)
}
}
trait SignatureValidHandler extends Handler {
override def handle(data: String): Unit = {
println(" Inspection signature 2")
super.handle(data)
}
}
class Payment extends DataValidHandler with SignatureValidHandler {
def pay(data: String): Unit = {
println(" User initiated payment request 1")
super.handle(data)
}
}
def main(args: Array[String]): Unit = {
val p = new Payment
p.pay(" Zhang San transfers it to Sister Feng 1000 element ")
}
}
边栏推荐
- Usage of ViewModel and livedata in jetpack
- 2022 melting welding and thermal cutting recurrent training question bank simulated examination platform operation
- 热力图展示相关矩阵
- Helm chart仓库操作
- [microservices sentinel] sentinel quick start | building an image | starting the console
- Infotnews | is the development of domestic NFT limited to digital collections?
- Decoupling pages and components using lifecycle
- Mobile security tool jar
- EVM Brief
- The interview questions and answers for the high-frequency software test of Dachang help you prepare for the golden nine silver ten
猜你喜欢

Databinding quick start (still using findviewbyid?)

傳輸層 以字節為單比特的滑動窗口技術

108页(4万字)未来公寓智能化设计平台项目方案建议书2022版

Text editor for QT project practice - Episode 12

2022安全员-C证考试模拟100题及在线模拟考试
![[redis realizes seckill service ②] solution to oversold problem](/img/b6/3073def06a56565894c28e49767e3e.png)
[redis realizes seckill service ②] solution to oversold problem

百公里加速仅5.92秒,威兰达高性能版以高能产品实力领跑
![[redis realizes seckill business ③] specific implementation of optimistic lock for oversold problem](/img/01/5ec4e5dae1748dce3d5dee33a24b0b.png)
[redis realizes seckill business ③] specific implementation of optimistic lock for oversold problem

Examination questions and mock examination for safety management personnel of hazardous chemical business units in 2022

Practical operation notes - notebook plus memory and ash cleaning
随机推荐
Decoupling pages and components using lifecycle
What is test development? Can you find a job at this stage?
Xcode preview displays a bug in the content of the list view and its solution
In the process of enterprise development, I found that a colleague used the select * from where condition for update
Thingsboard - rest API obtains and refreshes tokens
Examination questions and mock examination for safety management personnel of hazardous chemical business units in 2022
Text editor for QT project practice - Episode 10
生成订单30分钟未支付,则自动取消,该怎么实现?
Previous basic review
A plug-in framework for implementing registration free and login verification with hook technology
If the order has not been paid for 30 minutes, it will be automatically cancelled. How can I achieve this?
2022年全国最新消防设施操作员(高级消防设施操作员)模拟题及答案
The problem of multiple callback of video ads stimulated by applets (offcolse problem)
placeholder
Several ways for wechat applet to jump to the page are worth collecting
热力图展示相关矩阵
Basic summary of MySQL database knowledge
QT (35) - operate excel qxlsx qaxobject
Network request -volley
不重要的token可以提前停止计算!英伟达提出自适应token的高效视觉Transformer网络A-ViT,提高模型的吞吐量!...