Created
September 30, 2015 01:00
-
-
Save thecarlhall/eb7c489a767888262daf to your computer and use it in GitHub Desktop.
Intellij Live Template for create a fluent "with" method for a Java class variable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<templateSet group="Java"> | |
<template name="with" value="public $CLASS_NAME$ with$NAME$($VAR_TYPE$ $VAR_NAME$) { this.$VAR_NAME$ = $VAR_NAME$; return this; } $END$" description="Fluent getter" toReformat="false" toShortenFQNames="true"> | |
<variable name="CLASS_NAME" expression="className()" defaultValue="" alwaysStopAt="false" /> | |
<variable name="NAME" expression="" defaultValue=""Name"" alwaysStopAt="true" /> | |
<variable name="VAR_NAME" expression="decapitalize(NAME)" defaultValue="$NAME" alwaysStopAt="false" /> | |
<variable name="VAR_TYPE" expression="typeOfVariable(VAR_NAME)" defaultValue="$VAR_NAME" alwaysStopAt="false" /> | |
<context> | |
<option name="JAVA_CODE" value="true" /> | |
<option name="JAVA_STATEMENT" value="true" /> | |
<option name="JAVA_EXPRESSION" value="true" /> | |
<option name="JAVA_DECLARATION" value="true" /> | |
<option name="JAVA_COMMENT" value="true" /> | |
<option name="JAVA_STRING" value="true" /> | |
<option name="COMPLETION" value="true" /> | |
</context> | |
</template> | |
</templateSet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do you know what does <option name="COMPLETION" mean?
It is set to False in all templates*.xml files, and there is no interface elements to change its value...