对Java方法签名的完全合格的参考 [英] Fully qualified reference to Java method signature
问题描述
在Java中编写对方法名称的完全合格的引用的正确方法是什么?
What is the proper way to write a fully qualified reference to a method name in Java?
-
Message [] com.sun.mail.imap.IMAPFolder#addMessages(Message [])
-
Message [] com.sun.mail.imap.IMAPFolder.addMessages(Message [])
- 其他方式
推荐答案
如果方法的签名是 Message [] addMessages(Message [] msgs)
...
If the signature of the method is Message[] addMessages(Message[] msgs)
...
...并且类名是 IMAPFolder
...
...and the class name is IMAPFolder
...
...并且在软件包 com.sun.map.imap
...
...and it's in the package com.sun.map.imap
...
...然后,完全限定的方法名称为 com.sun.map.imap.IMAPFolder.addMessages(Message [] msgs)
.
...then the fully qualified method name would be com.sun.map.imap.IMAPFolder.addMessages(Message[] msgs)
.
可见的类/实例变量共享相同的模式,尽管出于OO设计的考虑,通常不建议这样做.
Visible class/instance variables share the same pattern, although for the sake of OO design, this is typically discouraged.
通常,人们只关心自己的标准对象名,而不是方法/[instance | class]变量名.
Normally, one only concerns themselves with the fully qualified object name, not the method/[instance|class] variable name.
这篇关于对Java方法签名的完全合格的参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!