AbstractPolymorphicMessageKey
abstract class AbstractPolymorphicMessageKey<out B : SingleMessage, out M : B>(baseKey: MessageKey<B>, safeCast: (SingleMessage) -> M?) : AbstractMessageKey<M> , MessageKey<M>
Content copied to clipboard
多态 MessageKey.
示例: HummerMessage
MessageContent
↑
HummerMessage
↑
+------------+-------------+------------+
| | | |
PokeMessage VipFace FlashImage ...
Content copied to clipboard
当 连接 一个 VipFace 到一个 MessageChain 时, 由于 VipFace 最上层为 MessageContent, 消息链中第一个 MessageContent 会被 (保留顺序地) 替换为 VipFace, 其他所有 MessageContent 都会被删除.
如:
val source: MessageSource = ...
val result = messageChainOf(PlainText("a"), PlainText("b"), source, AtAll) + VipFace.LiuLian
// result 为 [VipFace.LiuLian, source]
val result = source1 + source2
// result 为 [source2], 总是右侧替换左侧
Content copied to clipboard
Constructors
Link copied to clipboard
fun <out B : SingleMessage, out M : B> AbstractPolymorphicMessageKey(baseKey: MessageKey<B>, safeCast: (SingleMessage) -> M?)
Content copied to clipboard
Properties
Link copied to clipboard
将一个 SingleMessage 强转为 M 类型. 在类型不符合时返回 null
Inheritors
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard