* etc/MACHINES: Misc small edits.
[bpt/emacs.git] / etc / srecode / java.srt
CommitLineData
c05676c5
CY
1;; java.srt
2
ba318903 3;; Copyright (C) 2009-2014 Free Software Foundation, Inc.
c05676c5
CY
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
22set mode "java-mode"
23set escape_start "{{"
24set escape_end "}}"
25
26context file
27
28set comment_start "/**"
29set comment_end " */"
30set comment_prefix " *"
31
32template empty :file :user :time :java :indent
33"Fill out an empty file."
34sectiondictionary "CLASSSECTION"
35set NAME macro "FILENAME_AS_CLASS"
36----
37{{>:filecomment}}
38
39package {{FILENAME_AS_PACKAGE}};
40
41{{>CLASSSECTION:declaration:class}}
42
43----
44bind "e"
45
e8cc7880
DE
46template empty-main :file :user :time :java :indent
47"Fill out an empty file with a class having a static main method"
48sectiondictionary "CLASSSECTION"
49set NAME macro "FILENAME_AS_CLASS"
50----
51{{>:filecomment}}
52
53package {{FILENAME_AS_PACKAGE}};
54
55{{<CLASSSECTION:declaration:class}}
56public static void main(String args[]) {
57 {{^}}
58}
59{{/CLASSSECTION}}
60----
61bind "l"
62
c05676c5
CY
63context declaration
64
65template import :blank :indent
66"Template to import a package."
67----
68{{>:declaration:include}}
69----
70bind "i"
71
72template class :blank :indent
73"Template to declare a variable."
74sectiondictionary "DOCSECTION"
75set NAME macro "NAME"
76----
77{{>DOCSECTION:declaration:javadoc-class}}
78public class {{?NAME}} {
79
80 {{^}}
81
82} // {{NAME}}
83----
84bind "c"
85
86;;; Semantic Tag support
87;;
88template class-tag :indent :blank
89"Insert a Java class with the expectation of it being used by a tag inserter.
90Override this to affect applications, or the outer class structure for
91the user-facing template."
92----
93{{>:declaration:javadoc-class}}
e8cc7880
DE
94public class {{?NAME}} {{#PARENTS}}{{#FIRST}}extends {{/FIRST}}{{#NOTFIRST}}implements {{/NOTFIRST}}{{NAME}}{{/PARENTS}}
95{
c05676c5
CY
96 {{^}}
97};
98----
99
100template include :blank
101"An include statement."
102----
b9749554 103import {{?NAME}};
c05676c5
CY
104----
105
106context misc
107
108template 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
115context classdecl
116
117template function :indent :blank
118----
119public {{?TYPE}} {{?NAME}}{{>:misc:arglist}} {
120{{^}}
121}
122----
123bind "m"
124
125template variable :indent :blank
126"Insert a variable declaration."
127----
128{{?TYPE}} {{?NAME}}{{#HAVEDEFAULT}} = {{DEFAULT}}{{/HAVEDEFAULT}};
129----
130bind "v"
131
132;;; Java Doc Comments
133;;
134context classdecl
135
136prompt GROUPNAME "Name of declaration group: "
137
138template javadoc-function-group-start :indent :blank
139----
140/**
141 * {{?GROUPNAME}}
142 * @{
143 */
144
145----
146
147template javadoc-function-group-end :indent :blank
148----
149/**
150 * @}
151 */
152
153----
154
155context declaration
156
157template 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
170template 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
181template javadoc-variable-same-line
182----
183/**< {{DOC}}{{^}} */
184----
185
186template 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
114f9c96 198;; end