本文介绍了Corda-NULL_PARTY的目的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
NullKeys.NULL_PARTY
的目的是什么?
例如,我什么时候应该使用
For example, when should I use
party: AbstractParty = NullKeys.NULL_PATRY
而不是
party: AbstractParty? = null
推荐答案
party: AbstractParty? = null
上面定义了一个可为空的变量,即party将是 AbstractParty
或它将是 null
The above defines a nullable variable i.e. party will either be an AbstractParty
or it will be null
party: AbstractParty = NullKeys.NULL_PARTY
另一方面,以上内容永远不会导致聚会为 null
,但是最终您会得到一个 AnonymousParty
和一个 null code>公钥.
The above on the other hand, will never result in party being null
, but rather you'll end up with an AnonymousParty
with a null
public key.
NULL_PARTY
在单元测试期间可能会很有用,特别是在进行相等性测试时,但不建议将其用于生产代码.
NULL_PARTY
could come in useful during unit testing, particularly when testing for equality, but it's not advised to use it for production code.
这篇关于Corda-NULL_PARTY的目的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!