Added snippets for Emacs
This commit is contained in:
3
emacs/.emacs.d/snippets/java-mode/author
Normal file
3
emacs/.emacs.d/snippets/java-mode/author
Normal file
@@ -0,0 +1,3 @@
|
||||
#name : author
|
||||
# --
|
||||
@author <a href="mailto:torstein@skybert.net">Torstein Krause Johansen</a>$0
|
||||
6
emacs/.emacs.d/snippets/java-mode/debug
Normal file
6
emacs/.emacs.d/snippets/java-mode/debug
Normal file
@@ -0,0 +1,6 @@
|
||||
#name : debug
|
||||
# --
|
||||
if (mLogger.isDebugEnabled()) {
|
||||
mLogger.debug(String.format("${1:result}=%s", ${2:result}));
|
||||
}
|
||||
$0
|
||||
31
emacs/.emacs.d/snippets/java-mode/dwmain
Normal file
31
emacs/.emacs.d/snippets/java-mode/dwmain
Normal file
@@ -0,0 +1,31 @@
|
||||
#name : dwmain
|
||||
# --
|
||||
package ${1:net.skybert.dw};
|
||||
|
||||
import io.dropwizard.Application;
|
||||
import io.dropwizard.assets.AssetsBundle;
|
||||
import io.dropwizard.configuration.SubstitutingSourceProvider;
|
||||
import io.dropwizard.jetty.ConnectorFactory;
|
||||
import io.dropwizard.jetty.HttpConnectorFactory;
|
||||
import io.dropwizard.lifecycle.Managed;
|
||||
import io.dropwizard.server.DefaultServerFactory;
|
||||
import io.dropwizard.setup.Bootstrap;
|
||||
import io.dropwizard.setup.Environment;
|
||||
|
||||
/**
|
||||
* Main
|
||||
*/
|
||||
public class Main extends Application<${2:SkybertConf}> {
|
||||
|
||||
public static void main(final String[] args) throws Exception {
|
||||
new Main().run(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(
|
||||
final $2 pConfiguration,
|
||||
final Environment pEnvironment)
|
||||
throws Exception {
|
||||
$0
|
||||
}
|
||||
}
|
||||
5
emacs/.emacs.d/snippets/java-mode/fn
Normal file
5
emacs/.emacs.d/snippets/java-mode/fn
Normal file
@@ -0,0 +1,5 @@
|
||||
#name : new method/function
|
||||
# --
|
||||
${1:public} ${2:void} ${3:update}(final ${4:String} ${5:pName}) {
|
||||
$0
|
||||
}
|
||||
5
emacs/.emacs.d/snippets/java-mode/for
Normal file
5
emacs/.emacs.d/snippets/java-mode/for
Normal file
@@ -0,0 +1,5 @@
|
||||
#name : for (...; ...; ...) { ... }
|
||||
# --
|
||||
for (${1:Object} ${downcase-word 1} ; ${2:list}) {
|
||||
$0
|
||||
}
|
||||
5
emacs/.emacs.d/snippets/java-mode/fori
Normal file
5
emacs/.emacs.d/snippets/java-mode/fori
Normal file
@@ -0,0 +1,5 @@
|
||||
#name : for loop with index
|
||||
# --
|
||||
for (int ${1:i} = 0; $1 < ${2:args.length}; $1${3:++}) {
|
||||
$0
|
||||
}
|
||||
13
emacs/.emacs.d/snippets/java-mode/gse
Normal file
13
emacs/.emacs.d/snippets/java-mode/gse
Normal file
@@ -0,0 +1,13 @@
|
||||
#name : get/set/member variable
|
||||
# --
|
||||
private ${1:String} ${2:name};
|
||||
|
||||
public void set${2:$(capitalize text)}(final $1 p${2:$(capitalize text)}) {
|
||||
$2 = p${2:$(capitalize text)};
|
||||
}
|
||||
|
||||
public $1 get${2:$(capitalize text)}() {
|
||||
return $2;
|
||||
}
|
||||
$0
|
||||
|
||||
6
emacs/.emacs.d/snippets/java-mode/if
Normal file
6
emacs/.emacs.d/snippets/java-mode/if
Normal file
@@ -0,0 +1,6 @@
|
||||
#name : if
|
||||
# --
|
||||
if (${1:result} ${2:!=} ${3:null}) {
|
||||
$0
|
||||
}
|
||||
|
||||
4
emacs/.emacs.d/snippets/java-mode/iisblank
Normal file
4
emacs/.emacs.d/snippets/java-mode/iisblank
Normal file
@@ -0,0 +1,4 @@
|
||||
#name : static import of isBlank
|
||||
# --
|
||||
import static org.apache.commons.lang.StringUtils.isBlank;
|
||||
$0
|
||||
21
emacs/.emacs.d/snippets/java-mode/junitwrapperfns
Normal file
21
emacs/.emacs.d/snippets/java-mode/junitwrapperfns
Normal file
@@ -0,0 +1,21 @@
|
||||
#name : junitwrapperfns
|
||||
# --
|
||||
private void assertTrue(final String pMessage, final boolean pConditition) {
|
||||
Assertions.assertTrue(pConditition, pMessage);
|
||||
}
|
||||
|
||||
private void assertFalse(final String pMessage, final boolean pConditition) {
|
||||
Assertions.assertFalse(pConditition, pMessage);
|
||||
}
|
||||
|
||||
private void assertNotNull(final String pMessage, final Object pActual) {
|
||||
Assertions.assertNotNull(pActual, pMessage);
|
||||
}
|
||||
|
||||
private void assertNull(final String pMessage, final Object pActual) {
|
||||
Assertions.assertNull(pActual, pMessage);
|
||||
}
|
||||
|
||||
private void assertEquals(final String pMessage, final Object pExpected, final Object pActual) {
|
||||
Assertions.assertEquals(pExpected, pActual, pMessage);
|
||||
}
|
||||
5
emacs/.emacs.d/snippets/java-mode/main
Normal file
5
emacs/.emacs.d/snippets/java-mode/main
Normal file
@@ -0,0 +1,5 @@
|
||||
#name : main
|
||||
# --
|
||||
public static void main(String[] args) {
|
||||
$0
|
||||
}
|
||||
3
emacs/.emacs.d/snippets/java-mode/np
Normal file
3
emacs/.emacs.d/snippets/java-mode/np
Normal file
@@ -0,0 +1,3 @@
|
||||
#name : np
|
||||
# --
|
||||
// NOPMD
|
||||
3
emacs/.emacs.d/snippets/java-mode/ol
Normal file
3
emacs/.emacs.d/snippets/java-mode/ol
Normal file
@@ -0,0 +1,3 @@
|
||||
#name : get ObjectLoader
|
||||
# --
|
||||
$0ObjectLoader objectLoader = IOAPI.getAPI().getObjectLoader();
|
||||
6
emacs/.emacs.d/snippets/java-mode/req
Normal file
6
emacs/.emacs.d/snippets/java-mode/req
Normal file
@@ -0,0 +1,6 @@
|
||||
#name : req
|
||||
# --
|
||||
HttpRequest request = HttpRequest.newBuilder()
|
||||
.uri(URI.create($0))
|
||||
.timeout(Duration.ofMillis(getResponseTimeout()))
|
||||
.build();
|
||||
3
emacs/.emacs.d/snippets/java-mode/res
Normal file
3
emacs/.emacs.d/snippets/java-mode/res
Normal file
@@ -0,0 +1,3 @@
|
||||
#name : res
|
||||
# --
|
||||
HttpResponse<String> response = mHttpClient.send(request, ofString());$0
|
||||
3
emacs/.emacs.d/snippets/java-mode/sf
Normal file
3
emacs/.emacs.d/snippets/java-mode/sf
Normal file
@@ -0,0 +1,3 @@
|
||||
#name : sf
|
||||
# --
|
||||
String.format("%s", $0)
|
||||
3
emacs/.emacs.d/snippets/java-mode/sop
Normal file
3
emacs/.emacs.d/snippets/java-mode/sop
Normal file
@@ -0,0 +1,3 @@
|
||||
#name : System.out.println
|
||||
# --
|
||||
System.out.println($0);
|
||||
4
emacs/.emacs.d/snippets/java-mode/test
Normal file
4
emacs/.emacs.d/snippets/java-mode/test
Normal file
@@ -0,0 +1,4 @@
|
||||
@Test
|
||||
void ${1:can}() throws Exception {
|
||||
$0
|
||||
}
|
||||
12
emacs/.emacs.d/snippets/java-mode/tryf
Normal file
12
emacs/.emacs.d/snippets/java-mode/tryf
Normal file
@@ -0,0 +1,12 @@
|
||||
#name : try, catch & finally
|
||||
# --
|
||||
try {
|
||||
$0
|
||||
}
|
||||
catch (${1:Exception} ${2:e}) {
|
||||
mLogger.error($2);
|
||||
}
|
||||
finally {
|
||||
|
||||
}
|
||||
|
||||
8
emacs/.emacs.d/snippets/java-mode/tyc
Normal file
8
emacs/.emacs.d/snippets/java-mode/tyc
Normal file
@@ -0,0 +1,8 @@
|
||||
#name : try & catch
|
||||
# --
|
||||
try {
|
||||
$0
|
||||
}
|
||||
catch (${1:Exception} ${2:e}) {
|
||||
mLogger.error($2);
|
||||
}
|
||||
Reference in New Issue
Block a user