Skip to content

Instantly share code, notes, and snippets.

@tiwiz
Created June 22, 2015 15:06
Show Gist options
  • Save tiwiz/0f566178f4669bb2e37d to your computer and use it in GitHub Desktop.
Save tiwiz/0f566178f4669bb2e37d to your computer and use it in GitHub Desktop.
This is a Builder template (as in Android's Dialog.Builder) for IntelliJ/Android Studio. To import it, open any Java file and right click on an empty space. Go then to Generate > Getter and Setter and click on the "..." button on the Setter's line. From there create a new template with the "+" icon and paste this code
#set($paramName = $helper.getParamName($field, $project))
public ##
#if($field.modifierStatic)
static void ##
#else
$classname ##
#end
set$StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project)))($field.type $paramName) {
#if ($field.name == $paramName)
#if (!$field.modifierStatic)
this.##
#else
$classname.##
#end
#end
$field.name = $paramName;
#if(!$field.modifierStatic)
return this;
#end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment