]> code.delx.au - gnu-emacs/blob - etc/srecode/java.srt
Update copyright year to 2015
[gnu-emacs] / etc / srecode / java.srt
1 ;; java.srt
2
3 ;; Copyright (C) 2009-2015 Free Software Foundation, Inc.
4
5 ;; Author: Eric M. Ludlam <eric@siege-engine.com>
6
7 ;; This file is part of GNU Emacs.
8
9 ;; GNU Emacs is free software: you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation, either version 3 of the License, or
12 ;; (at your option) any later version.
13
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
21
22 set mode "java-mode"
23 set escape_start "{{"
24 set escape_end "}}"
25
26 context file
27
28 set comment_start "/**"
29 set comment_end " */"
30 set comment_prefix " *"
31
32 template empty :file :user :time :java :indent
33 "Fill out an empty file."
34 sectiondictionary "CLASSSECTION"
35 set NAME macro "FILENAME_AS_CLASS"
36 ----
37 {{>:filecomment}}
38
39 package {{FILENAME_AS_PACKAGE}};
40
41 {{>CLASSSECTION:declaration:class}}
42
43 ----
44 bind "e"
45
46 template empty-main :file :user :time :java :indent
47 "Fill out an empty file with a class having a static main method"
48 sectiondictionary "CLASSSECTION"
49 set NAME macro "FILENAME_AS_CLASS"
50 ----
51 {{>:filecomment}}
52
53 package {{FILENAME_AS_PACKAGE}};
54
55 {{<CLASSSECTION:declaration:class}}
56 public static void main(String args[]) {
57 {{^}}
58 }
59 {{/CLASSSECTION}}
60 ----
61 bind "l"
62
63 context declaration
64
65 template import :blank :indent
66 "Template to import a package."
67 ----
68 {{>:declaration:include}}
69 ----
70 bind "i"
71
72 template class :blank :indent
73 "Template to declare a variable."
74 sectiondictionary "DOCSECTION"
75 set NAME macro "NAME"
76 ----
77 {{>DOCSECTION:declaration:javadoc-class}}
78 public class {{?NAME}} {
79
80 {{^}}
81
82 } // {{NAME}}
83 ----
84 bind "c"
85
86 ;;; Semantic Tag support
87 ;;
88 template class-tag :indent :blank
89 "Insert a Java class with the expectation of it being used by a tag inserter.
90 Override this to affect applications, or the outer class structure for
91 the user-facing template."
92 ----
93 {{>:declaration:javadoc-class}}
94 public class {{?NAME}} {{#PARENTS}}{{#FIRST}}extends {{/FIRST}}{{#NOTFIRST}}implements {{/NOTFIRST}}{{NAME}}{{/PARENTS}}
95 {
96 {{^}}
97 };
98 ----
99
100 template include :blank
101 "An include statement."
102 ----
103 import {{?NAME}};
104 ----
105
106 context misc
107
108 template arglist
109 "Insert an argument list for a function.
110 @todo - Support smart CR in a buffer for not too long lines."
111 ----
112 ({{#ARGS}}{{TYPE}} {{NAME}}{{#NOTLAST}},{{/NOTLAST}}{{/ARGS}})
113 ----
114
115 context classdecl
116
117 template function :indent :blank
118 ----
119 public {{?TYPE}} {{?NAME}}{{>:misc:arglist}} {
120 {{^}}
121 }
122 ----
123 bind "m"
124
125 template variable :indent :blank
126 "Insert a variable declaration."
127 ----
128 {{?TYPE}} {{?NAME}}{{#HAVEDEFAULT}} = {{DEFAULT}}{{/HAVEDEFAULT}};
129 ----
130 bind "v"
131
132 ;;; Java Doc Comments
133 ;;
134 context classdecl
135
136 prompt GROUPNAME "Name of declaration group: "
137
138 template javadoc-function-group-start :indent :blank
139 ----
140 /**
141 * {{?GROUPNAME}}
142 * @{
143 */
144
145 ----
146
147 template javadoc-function-group-end :indent :blank
148 ----
149 /**
150 * @}
151 */
152
153 ----
154
155 context declaration
156
157 template javadoc-class :indent :blank :time :user :tag
158 ----
159 /**
160 * {{DOC}}{{^}}
161 *
162 * Created: {{DATE}}
163 *
164 * @author {{AUTHOR}}
165 * @version
166 * @since
167 */
168 ----
169
170 template javadoc-function :indent :blank :tag
171 ----
172 /**
173 * {{DOC}}{{^}}
174 * {{#ARGS}}
175 * @param {{?NAME}} - {{DOC}}{{/ARGS}}
176 * @return {{TYPE}}{{#THROWS}}
177 * @exception {{NAME}} - {{EXDOC}}{{/THROWS}}
178 */
179 ----
180
181 template javadoc-variable-same-line
182 ----
183 /**< {{DOC}}{{^}} */
184 ----
185
186 template javadoc-section-comment :blank :indent
187 "Insert a comment that separates sections of an Emacs Lisp file."
188 ----
189 \f
190 /** {{?TITLE}}
191 *
192 * {{^}}
193 */
194
195 ----
196
197
198 ;; end