Java coding style 注意事項
1 2 3
| private String fyr = StringUtils.EMPTY; private String fyr = "";
|
1 2 3 4 5
| if (!StringUtils.equals("G3", toPos)) {...} if (!Objects.equals("G3", toPos)) {...} if ("G3".equals(toPos)) {...}
|
1 2 3 4 5 6 7 8 9
| List<Cta612pDto> cta612Dtos = sqlExecutor .queryForList(query, Cta612pDto.class); if (CollectionUtils.isNotEmpty(cta612Dtos)) {...}
List<Cta612pDto> cta612Dtos = sqlExecutor .queryForList(query, Cta612pDto.class); if (!cta612Dtos.isEmpty()) {...}
|
1 2 3
| private BigDecimal pAmt = new BigDecimal(0); private BigDecimal pAmt = BigDecimal.ZERO;
|
1 2 3 4 5 6
| if (Arrays.asList(new String[] {"20", "21"}) .contains(pAge)) {...} private static final Set<String> VALID_P_AGES = ImmutableSet.of("20", "21"); if (VALID_P_AGES.contains(pAge)) {...}
|
請做 local variable …
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| page = list.get(i).getAge(); pacc = list.get(i).getAcc(); pasp = list.get(i).getAsp(); pagency = list.get(i).getAgency(); if (StringUtils.isNotBlank(list.get(i).getName()) && StringUtils.equals("Z0", list.get(i).getAsp())) { pname = "追加減預算"; } else { pname = list.get(i).getName(); } paccalt = list.get(i).getAccalt(); pypay = list.get(i).getYpay(); pctl = list.get(i).getCtl(); pdispos = list.get(i).getDispos();
|
6. 如何 debug (chrome & eclipse debug)
chrome:
https://developers.google.com/web/tools/chrome-devtools/javascript/step-code?hl=zh-tw
https://pjchender.blogspot.com/2017/06/chrome-dev-tools.html
https://raygun.com/blog/debug-javascript-google-chrome/
https://leeon.gitbooks.io/devtools/content/
https://medium.freecodecamp.org/how-you-can-improve-your-workflow-using-the-javascript-console-bdd7823a9472
eclipse:
https://cpmaltose.wordpress.com/2017/08/06/debugger-fast-tutorial/
http://www.vogella.com/tutorials/EclipseDebugging/article.html