java - Javadoc 正确格式
问题描述
我是编程/Java 新手,过去几周我一直在尝试使用一些免费教科书和在线资源自学它。我认为学习的一个好方法是将我喜欢的角色扮演游戏构建到 Java 程序中。话虽如此,我知道很多人没有有效地记录他们的代码并希望避免这成为一种习惯,所以我试图尽可能详细地记录所有内容。我无法弄清楚我是否正确地记录了这一点,即使在引用 Javadoc 页面时也是如此,所以任何帮助都将不胜感激。基本上我有一个“角色”类,它实现了这个游戏中角色的所有必需方面。例如,我有一个枚举,它是游戏中角色可能的能力得分列表:
/**
* AbilityScores is an enum type containing all the possible ability scores in the game. It is
* utilized by the HashMap {@link #abilities} for the keys with an int being used as the values.
*/
private enum AbilityScores {
STRENGTH,
DEXTERITY,
CONSTITUTION,
INTELLIGENCE,
WISDOM,
CHARISMA,
INSPIRATION,
ARMOURCLASS
}
然后我有相应的HashMap:
/**
* abilities is a {@link HashMap} collection that contains {@link AbilityScores} as
* keys and {@link Integer} as values.
*/
private HashMap<AbilityScores, Integer> abilities = new HashMap<AbilityScores, Integer>();
然后这是我的角色强度访问器方法的示例:
/**
* This method returns a character's strength in the form of an integer.
* @return strength as an integer.
*/
public int getStrength() {
return abilities.get(AbilityScores.STRENGTH);
}
我是否正确记录了这一点,或者我是否错误地使用了“@link”等。我确实找到了一些示例,但我不是 100% 确定,因为我找不到一个完整的示例(如果有的话,请道歉)像这样开始结束。
任何意见或指导表示赞赏!谢谢
解决方案
推荐阅读
- r - Eigenvalues of a matrix, assuming symmetry
- php - 获取解析错误,PHP代码中的语法错误
- python - 获取列的“循环滞后”
- batch-file - 如何使文本行的第一部分唯一并批量连接第二部分?
- javascript - 我如何操作一个 javaScript 对象
- python - 如何访问组对象的属性?AttributeError:“组”对象没有属性“风险级别”
- python-3.x - 如何从文件 URL 中获取内容长度?
- python - 在 sns.swarmplot 中设置 xticks
- r - R:如何从纽约市邮政编码的特定列中创建一个包含正确行政区的新列?
- r - 在函数内部或外部运行 lm() 时结果不同