我有一个带有泛型类型P的Java类.我想在Javadoc中记录它.通常我只是这样做:
/**
* ...
* @param <P> the type of publisher
*/
Run Code Online (Sandbox Code Playgroud)
这在实际的Javadoc中显示得很好.但是,CheckStyle警告我需要记录类型P,因为它将<P>呈现为HTML段落.此外,Eclipse格式化程序也将其解释为段落,因此它会混淆格式.
是否有更好的方法来记录类型为P的类型参数?我知道我可以禁用Eclipse格式化程序,不再自动格式化javadoc,但我宁愿不这样做(并且无论如何都不会解决checkstyle问题).
我也知道我可以将P重命名为其他东西,但考虑到我在这里使用的泛型类型的数量,它会使事情的可读性降低很多.
我正在尝试对一组用马其顿字母书写的字符串进行排序.我知道怎么做,但最终结果不是我的预期.这是我的测试程序:
public class Main {
private static final char[] ALPHABET_ARRAY = {
'?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?','?', '?' };
public static void main(String[] args) {
Collator collator = Collator.getInstance(new Locale("mk", "MK"));
List<String> list = new LinkedList<>();
for (int i = 0; i < ALPHABET_ARRAY.length; i++) {
list.add("" + ALPHABET_ARRAY[i]);
}
list.sort(collator::compare);
list.forEach(System.out::print);
}
}
Run Code Online (Sandbox Code Playgroud)
字母ALPHABET_ARRAY …
我的emqttd服务器经常崩溃,我无法弄清楚原因.这是error.log文件的片段:
2018-04-19 10:53:05.215 [error] <0.6456.0> gen_server <0.6456.0> terminated with reason: no match of right hand value {pubrel,76,{1524,127985,200713}} in emqttd_session:acked/3 line 736
2018-04-19 10:53:05.216 [error] <0.6456.0> CRASH REPORT Process <0.6456.0> with 1 neighbours exited with reason: no match of right hand value {pubrel,76,{1524,127985,200713}} in emqttd_session:acked/3 line 736 in gen_server2:terminate/3 line 1157
2018-04-19 10:53:05.216 [error] <0.1107.0> Supervisor emqttd_session_sup had child session started with {emqttd_session,start_link,undefined} at <0.6456.0> exit with reason no match of right hand value {pubrel,76,{1524,127985,200713}} in emqttd_session:acked/3 line 736 in context …
Run Code Online (Sandbox Code Playgroud) 所以我正在构建一个 REST api 并需要创建一些 url。问题是,我遇到了一些相互冲突的路径。例如:
GET <type>/<id>
获取给定类型和 id 的对象的详细信息GET <type>/summary
获取给定类型的对象的摘要这个简化的示例显示当对象的 ID 为“summary”时会出现问题。解决这个问题的最佳方法是什么?从 REST 清教徒的角度来看,解决方案应该是什么?
这是我的一些想法:
<id>
查询参数。据我了解,这不符合标准