java.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. ace.define("ace/snippets/java",["require","exports","module"], function(require, exports, module) {
  2. "use strict";
  3. exports.snippetText = "## Access Modifiers\n\
  4. snippet po\n\
  5. protected\n\
  6. snippet pu\n\
  7. public\n\
  8. snippet pr\n\
  9. private\n\
  10. ##\n\
  11. ## Annotations\n\
  12. snippet before\n\
  13. @Before\n\
  14. static void ${1:intercept}(${2:args}) { ${3} }\n\
  15. snippet mm\n\
  16. @ManyToMany\n\
  17. ${1}\n\
  18. snippet mo\n\
  19. @ManyToOne\n\
  20. ${1}\n\
  21. snippet om\n\
  22. @OneToMany${1:(cascade=CascadeType.ALL)}\n\
  23. ${2}\n\
  24. snippet oo\n\
  25. @OneToOne\n\
  26. ${1}\n\
  27. ##\n\
  28. ## Basic Java packages and import\n\
  29. snippet im\n\
  30. import\n\
  31. snippet j.b\n\
  32. java.beans.\n\
  33. snippet j.i\n\
  34. java.io.\n\
  35. snippet j.m\n\
  36. java.math.\n\
  37. snippet j.n\n\
  38. java.net.\n\
  39. snippet j.u\n\
  40. java.util.\n\
  41. ##\n\
  42. ## Class\n\
  43. snippet cl\n\
  44. class ${1:`Filename(\"\", \"untitled\")`} ${2}\n\
  45. snippet in\n\
  46. interface ${1:`Filename(\"\", \"untitled\")`} ${2:extends Parent}${3}\n\
  47. snippet tc\n\
  48. public class ${1:`Filename()`} extends ${2:TestCase}\n\
  49. ##\n\
  50. ## Class Enhancements\n\
  51. snippet ext\n\
  52. extends \n\
  53. snippet imp\n\
  54. implements\n\
  55. ##\n\
  56. ## Comments\n\
  57. snippet /*\n\
  58. /*\n\
  59. * ${1}\n\
  60. */\n\
  61. ##\n\
  62. ## Constants\n\
  63. snippet co\n\
  64. static public final ${1:String} ${2:var} = ${3};${4}\n\
  65. snippet cos\n\
  66. static public final String ${1:var} = \"${2}\";${3}\n\
  67. ##\n\
  68. ## Control Statements\n\
  69. snippet case\n\
  70. case ${1}:\n\
  71. ${2}\n\
  72. snippet def\n\
  73. default:\n\
  74. ${2}\n\
  75. snippet el\n\
  76. else\n\
  77. snippet elif\n\
  78. else if (${1}) ${2}\n\
  79. snippet if\n\
  80. if (${1}) ${2}\n\
  81. snippet sw\n\
  82. switch (${1}) {\n\
  83. ${2}\n\
  84. }\n\
  85. ##\n\
  86. ## Create a Method\n\
  87. snippet m\n\
  88. ${1:void} ${2:method}(${3}) ${4:throws }${5}\n\
  89. ##\n\
  90. ## Create a Variable\n\
  91. snippet v\n\
  92. ${1:String} ${2:var}${3: = null}${4};${5}\n\
  93. ##\n\
  94. ## Enhancements to Methods, variables, classes, etc.\n\
  95. snippet ab\n\
  96. abstract\n\
  97. snippet fi\n\
  98. final\n\
  99. snippet st\n\
  100. static\n\
  101. snippet sy\n\
  102. synchronized\n\
  103. ##\n\
  104. ## Error Methods\n\
  105. snippet err\n\
  106. System.err.print(\"${1:Message}\");\n\
  107. snippet errf\n\
  108. System.err.printf(\"${1:Message}\", ${2:exception});\n\
  109. snippet errln\n\
  110. System.err.println(\"${1:Message}\");\n\
  111. ##\n\
  112. ## Exception Handling\n\
  113. snippet as\n\
  114. assert ${1:test} : \"${2:Failure message}\";${3}\n\
  115. snippet ca\n\
  116. catch(${1:Exception} ${2:e}) ${3}\n\
  117. snippet thr\n\
  118. throw\n\
  119. snippet ths\n\
  120. throws\n\
  121. snippet try\n\
  122. try {\n\
  123. ${3}\n\
  124. } catch(${1:Exception} ${2:e}) {\n\
  125. }\n\
  126. snippet tryf\n\
  127. try {\n\
  128. ${3}\n\
  129. } catch(${1:Exception} ${2:e}) {\n\
  130. } finally {\n\
  131. }\n\
  132. ##\n\
  133. ## Find Methods\n\
  134. snippet findall\n\
  135. List<${1:listName}> ${2:items} = ${1}.findAll();${3}\n\
  136. snippet findbyid\n\
  137. ${1:var} ${2:item} = ${1}.findById(${3});${4}\n\
  138. ##\n\
  139. ## Javadocs\n\
  140. snippet /**\n\
  141. /**\n\
  142. * ${1}\n\
  143. */\n\
  144. snippet @au\n\
  145. @author `system(\"grep \\`id -un\\` /etc/passwd | cut -d \\\":\\\" -f5 | cut -d \\\",\\\" -f1\")`\n\
  146. snippet @br\n\
  147. @brief ${1:Description}\n\
  148. snippet @fi\n\
  149. @file ${1:`Filename()`}.java\n\
  150. snippet @pa\n\
  151. @param ${1:param}\n\
  152. snippet @re\n\
  153. @return ${1:param}\n\
  154. ##\n\
  155. ## Logger Methods\n\
  156. snippet debug\n\
  157. Logger.debug(${1:param});${2}\n\
  158. snippet error\n\
  159. Logger.error(${1:param});${2}\n\
  160. snippet info\n\
  161. Logger.info(${1:param});${2}\n\
  162. snippet warn\n\
  163. Logger.warn(${1:param});${2}\n\
  164. ##\n\
  165. ## Loops\n\
  166. snippet enfor\n\
  167. for (${1} : ${2}) ${3}\n\
  168. snippet for\n\
  169. for (${1}; ${2}; ${3}) ${4}\n\
  170. snippet wh\n\
  171. while (${1}) ${2}\n\
  172. ##\n\
  173. ## Main method\n\
  174. snippet main\n\
  175. public static void main (String[] args) {\n\
  176. ${1:/* code */}\n\
  177. }\n\
  178. ##\n\
  179. ## Print Methods\n\
  180. snippet print\n\
  181. System.out.print(\"${1:Message}\");\n\
  182. snippet printf\n\
  183. System.out.printf(\"${1:Message}\", ${2:args});\n\
  184. snippet println\n\
  185. System.out.println(${1});\n\
  186. ##\n\
  187. ## Render Methods\n\
  188. snippet ren\n\
  189. render(${1:param});${2}\n\
  190. snippet rena\n\
  191. renderArgs.put(\"${1}\", ${2});${3}\n\
  192. snippet renb\n\
  193. renderBinary(${1:param});${2}\n\
  194. snippet renj\n\
  195. renderJSON(${1:param});${2}\n\
  196. snippet renx\n\
  197. renderXml(${1:param});${2}\n\
  198. ##\n\
  199. ## Setter and Getter Methods\n\
  200. snippet set\n\
  201. ${1:public} void set${3:}(${2:String} ${4:}){\n\
  202. this.$4 = $4;\n\
  203. }\n\
  204. snippet get\n\
  205. ${1:public} ${2:String} get${3:}(){\n\
  206. return this.${4:};\n\
  207. }\n\
  208. ##\n\
  209. ## Terminate Methods or Loops\n\
  210. snippet re\n\
  211. return\n\
  212. snippet br\n\
  213. break;\n\
  214. ##\n\
  215. ## Test Methods\n\
  216. snippet t\n\
  217. public void test${1:Name}() throws Exception {\n\
  218. ${2}\n\
  219. }\n\
  220. snippet test\n\
  221. @Test\n\
  222. public void test${1:Name}() throws Exception {\n\
  223. ${2}\n\
  224. }\n\
  225. ##\n\
  226. ## Utils\n\
  227. snippet Sc\n\
  228. Scanner\n\
  229. ##\n\
  230. ## Miscellaneous\n\
  231. snippet action\n\
  232. public static void ${1:index}(${2:args}) { ${3} }\n\
  233. snippet rnf\n\
  234. notFound(${1:param});${2}\n\
  235. snippet rnfin\n\
  236. notFoundIfNull(${1:param});${2}\n\
  237. snippet rr\n\
  238. redirect(${1:param});${2}\n\
  239. snippet ru\n\
  240. unauthorized(${1:param});${2}\n\
  241. snippet unless\n\
  242. (unless=${1:param});${2}\n\
  243. ";
  244. exports.scope = "java";
  245. });