当前位置:网站首页>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 ")
}
}
边栏推荐
- Use of navigation and navigationui
- 【Redis实现秒杀业务②】超卖问题的解决方案
- Databinding quick start (still using findviewbyid?)
- 2022 crane driver (limited to bridge crane) examination question bank simulated examination platform operation
- Helm chart warehouse operation
- Mobile security tool apktool
- Use of JMeter
- Go crawler framework -colly actual combat (III) -- panoramic cartoon picture capture and download
- Easy to wear - drop down radio
- Realization of MNIST handwritten numeral recognition
猜你喜欢

ros(24):error: invalid initialization of reference of type ‘xx’ from expression of type ‘xx’

Text editor for QT project practice -- Episode 9

Virtual machine - network configuration

Databinding quick start (still using findviewbyid?)

QT(35)-操作EXCEL-QXlsx-QAxObject

Activity startup process
![[microservices sentinel] cluster link | microservices cluster environment construction](/img/75/3cc6abf1e72d651b082415db9db46c.png)
[microservices sentinel] cluster link | microservices cluster environment construction

I brush the question I - copy the linked list with random pointer

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

2022R1快开门式压力容器操作考题及答案
随机推荐
2022年起重机司机(限桥式起重机)考试题库模拟考试平台操作
2021-04-18
Only positive integers can be entered in the text box
2022年危险化学品经营单位安全管理人员考试试题及模拟考试
Apk decompiled method (not confused)
Jar package merging using Apache ant
ros(24):error: invalid initialization of reference of type ‘xx’ from expression of type ‘xx’
2022r1 quick opening pressure vessel operation test questions and answers
I 刷题 I — 复制带随机指针的链表
2022 simulated 100 questions of safety officer-c certificate examination and online simulated examination
adb shell getevent
Infotnews | is the development of domestic NFT limited to digital collections?
Custom animation (simulated win10 loading animation)
Single blind box removal, social blind box and friend blind box program source code
百公里加速仅5.92秒,威兰达高性能版以高能产品实力领跑
【微服务|Sentinel】簇点链路|微服务集群环境搭建
QT(35)-操作EXCEL-QXlsx-QAxObject
Go crawler framework -colly actual combat (II) -- Douban top250 crawling
Source code analysis the problem that fragments cannot be displayed in the custom ViewGroup
VNC viewer remote connection raspberry pie without display