So here comes the first one: how to create a template that will save me a bit of typing every time I need to add a logger to a class.
Preferences -> java -> editor -> templates, "new...".
name: log
description: Logger definition
context: java
automatically insert: yes
pattern:
private static final ${typeLogger:newType(org.slf4j.Logger)}
${name:newName(log)} =
${typeFactory:newType(org.slf4j.LoggerFactory)}.getLogger(${enclosing_type}.class);
All that you need to type in your code afterwards is "log" & ctrl+space. Of course it will work just as nicely with any other log library.
No comments:
Post a Comment