Eclipse templates for auto code generation

Working with an IDE tends to make life quiet simple. However we still do not leverage the full potential of using an IDE like Eclipse. During development, i have found creating a few templates really helps to speed up things. Here are the few most common ones i use which are not part of the standard templates.
1) Log4J Logging
a) Create Logger

private static final Logger logger = Logger.getLogger(${enclosing_type}.class);

b) LogInfo${word_selection}${});${cursor}

c) LogError

logger.error(${errorMessage}, ${e});

d) LogDebug


2) Constants
a) Const

private static final ${type} ${name} = new ${type} ${cursor};

3) Map Iteration
a) MapIter

for(Map.Entry entry :
${map:var(java.util.Map)}.entrySet()) {
${key} key = entry.getKey();
${value} value = entry.getValue();

4) JUnit
a) Test Creation

public void test${name}() throws Exception {


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: