Quantcast
Channel: Oracle Bloggers
Viewing all articles
Browse latest Browse all 19780

Customizable Method Bodies in NetBeans IDE 7.3

$
0
0
In NetBeans IDE 7.3, bodies of newly created methods can now be customized in Tools/Templates/Java/Code Snippets, see below:

The content of the first of the two above, "Generated Method Body", is like this:

<#--
A built-in Freemarker template (see http://freemarker.sourceforge.net) used for
filling the body of methods generated by the IDE. When editing the template,
the following predefined variables, that will be then expanded into
the corresponding values, could be used together with Java expressions and
comments:
${method_return_type}       a return type of a created method
${default_return_value}     a value returned by the method by default
${method_name}              name of the created method
${class_name}               qualified name of the enclosing class
${simple_class_name}        simple name of the enclosing class
-->
throw new java.lang.UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.

The second one, "Overriden Methody Body", is as follows:

<#--
A built-in Freemarker template (see http://freemarker.sourceforge.net) used for
filling the body of overridden methods generated by the IDE. When editing
the template, the following predefined variables, that will be then expanded
into the corresponding values, could be used together with Java expressions and
comments:
${super_method_call}        a super method call
${method_return_type}       a return type of a created method
${default_return_value}     a value returned by the method by default
${method_name}              name of the created method
${class_name}               qualified name of the enclosing class
${simple_class_name}        simple name of the enclosing class
--><#if method_return_type?? && method_return_type != "void">
return ${super_method_call}; //To change body of generated methods, choose Tools | Templates.<#else>
${super_method_call}; //To change body of generated methods, choose Tools | Templates.</#if>

Viewing all articles
Browse latest Browse all 19780

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>