首页 > 解决方案 > Corda:类 [Party] 和 [Party?] 有什么区别?

问题描述

帐户中的 [Party] 和 [Party?] 有什么区别?

这是关于帐户的链接:https ://github.com/corda/accounts/tree/release/pre/1/v4

我可以将 [Party?] 的对象转换为 [Party] 吗?

标签: corda

解决方案


[Party?] 表示对象可以为 null 或 [Party] 类对象。这是 Kotlin 的方式来指示对象可以为 null 或特定对象。

在代码中:

// Returns the Party which hosts the account specified by account ID.
    fun hostForAccount(accountId: UUID): Party?

这基本上意味着返回类型可以是 null 或 [Party] 对象。

PS:【派对】是Corda类


推荐阅读