Special Code Template Syntax

You can use code templates to speed up the entry of commonly used sequences of reserved words and common code patterns. For example, if you enter forc and press the Tab key, it expands into the following:

for (Iterator it = collection.iterator(); it.hasNext();) {
  Object elem = (Object) it.next();
} 

When you create code templates, there are several constructs that you can use to customize the way the code template behaves. You can look at the default IDE code templates in the Options window, under the Tools menu, for examples from which you can learn.

In general, a code template parameter can be specified by its name and a set of optional hints. Hints serve as guidance when computing the values assigned by the infrastructure to the parameters on template expansion. Syntax for parameter definition is as follows:

${param_name hint=value hint=value ...}

However, boolean hints that can be written without the value part:

${param_name hint} translates to ${param_name hint=true}

Some parameter names are reserved by the code template infrastructure:

Similarly, some of the hint names are reserved by the code template infrastructure:


Legal Notices