Update copyright year to 2014 by running admin/update-copyright.
[emacs.git] / etc / srecode / java.srt
blob65cd3a54f473127b57f4ff847b1c60f83e415f49
1 ;; java.srt
3 ;; Copyright (C) 2009-2014 Free Software Foundation, Inc.
5 ;; Author: Eric M. Ludlam <eric@siege-engine.com>
7 ;; This file is part of GNU Emacs.
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.
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.
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/>.
22 set mode "java-mode"
23 set escape_start "{{"
24 set escape_end "}}"
26 context file
28 set comment_start  "/**"
29 set comment_end    " */"
30 set comment_prefix " *"
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}}
39 package {{FILENAME_AS_PACKAGE}};
41 {{>CLASSSECTION:declaration:class}}
43 ----
44 bind "e"
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}}
53 package {{FILENAME_AS_PACKAGE}};
55 {{<CLASSSECTION:declaration:class}}
56 public static void main(String args[]) {
57        {{^}}
59 {{/CLASSSECTION}}
60 ----
61 bind "l"
63 context declaration
65 template import :blank :indent
66 "Template to import a package."
67 ----
68 {{>:declaration:include}}
69 ----
70 bind "i"
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}} {
80    {{^}}
82 } // {{NAME}}
83 ----
84 bind "c"
86 ;;; Semantic Tag support
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}}
96    {{^}}
98 ----
100 template include :blank
101 "An include statement."
102 ----
103 import {{?NAME}};
104 ----
106 context misc
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 ----
115 context classdecl
117 template function :indent :blank
118 ----
119 public {{?TYPE}} {{?NAME}}{{>:misc:arglist}} {
120 {{^}}
122 ----
123 bind "m"
125 template variable :indent :blank
126 "Insert a variable declaration."
127 ----
128 {{?TYPE}} {{?NAME}}{{#HAVEDEFAULT}} = {{DEFAULT}}{{/HAVEDEFAULT}};
129 ----
130 bind "v"
132 ;;; Java Doc Comments
134 context classdecl
136 prompt GROUPNAME "Name of declaration group: "
138 template javadoc-function-group-start :indent :blank
139 ----
141  * {{?GROUPNAME}}
142  * @{
143  */
145 ----
147 template javadoc-function-group-end :indent :blank
148 ----
150  * @}
151  */
153 ----
155 context declaration
157 template javadoc-class :indent :blank :time :user :tag
158 ----
160  * {{DOC}}{{^}}
162  * Created: {{DATE}}
164  * @author {{AUTHOR}}
165  * @version 
166  * @since 
167  */
168 ----
170 template javadoc-function :indent :blank :tag
171 ----
173  * {{DOC}}{{^}}
174  * {{#ARGS}}
175  * @param {{?NAME}} - {{DOC}}{{/ARGS}}
176  * @return {{TYPE}}{{#THROWS}}
177  * @exception {{NAME}} - {{EXDOC}}{{/THROWS}}
178  */
179 ----
181 template javadoc-variable-same-line
182 ----
183 /**< {{DOC}}{{^}} */
184 ----
186 template javadoc-section-comment :blank :indent
187 "Insert a comment that separates sections of an Emacs Lisp file."
188 ----
190 /** {{?TITLE}}
192  * {{^}}
193  */
195 ----
198 ;; end