增加消息发送借口, 修订query对象名称

This commit is contained in:
2020-05-21 15:14:02 +08:00
parent 98b4dc639c
commit 2f0746b2c5
5 changed files with 38 additions and 31 deletions

View File

@@ -10,6 +10,13 @@ import java.util.*
* @tparam T 消息数据类型
*/
open class Message<T>(var status: Int = Status.Success) {
/**
* 获取状态是否成功
*/
val success: Boolean
get() = this.status == Status.Success
/**
* 传递的业务数据
*/
@@ -38,6 +45,12 @@ open class Message<T>(var status: Int = Status.Success) {
this.message = message
}
/**
* 从另一对象中复制数据
*
* @param other 另一消息对象
*/
open fun from(other: Message<T>) {
this.status = other.status
this.data = other.data

View File

@@ -0,0 +1,5 @@
package com.synebula.gaea.io.messager
interface IEmailMessenger {
fun sendMessage(receivers: List<String>, subject: String, content: String)
}

View File

@@ -1,14 +0,0 @@
package com.synebula.gaea.test
import com.synebula.gaea.data.code.SnowflakeCode
import junit.framework.TestCase
class CodeGenerateTest : TestCase() {
fun testSnowflake() {
val snowflakeCode = SnowflakeCode(1, 1)
for (i in 0..10) {
Thread.sleep(1000)
println(snowflakeCode.generate())
}
}
}