Skip to content

Instantly share code, notes, and snippets.

@serj-lotutovici
Last active June 2, 2018 16:27
Show Gist options
  • Save serj-lotutovici/845062d79af0ca6461bf to your computer and use it in GitHub Desktop.
Save serj-lotutovici/845062d79af0ca6461bf to your computer and use it in GitHub Desktop.
Kotlin Style Getter and Setter templates for IntelliJ Idea. https://www.jetbrains.com/idea/help/generating-getters-and-setters.html for more info
public ##
#if($field.modifierStatic)
static ##
#end
$field.type ##
#set($name = $StringUtil.decapitalize($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project))))
${name}() {
return $field.name;
}
#set($paramName = $helper.getParamName($field, $project))
public ##
#if($field.modifierStatic)
static void ##
#else
$classname ##
#end
#set($name = $StringUtil.decapitalize($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project))))
${name}($field.type $paramName) {
#if ($field.name == $paramName)
#if (!$field.modifierStatic)
this.##
#else
$classname.##
#end
#end
$field.name = $paramName;
#if(!$field.modifierStatic)
return this;
#end
}
@boxcee
Copy link

boxcee commented Jan 12, 2017

Is there an IntelliJ template grammar reference?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment