Skip to content

Instantly share code, notes, and snippets.

@Keshava11
Created March 2, 2017 10:39
Show Gist options
  • Save Keshava11/a0d371ab3194887c36628752e6b2b4ff to your computer and use it in GitHub Desktop.
Save Keshava11/a0d371ab3194887c36628752e6b2b4ff to your computer and use it in GitHub Desktop.
Android Studio Getter template for member names starting with 'm' and 's'
#if($field.modifierStatic)
static ##
#end
$field.type ##
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project))))
#if ($name.length() > 1 && ($StringUtil.startsWith($name, 'm') || $StringUtil.startsWith($name, 's')))
#set($name = $name.substring(1))
#end
#if ($field.boolean && $field.primitive)
#if ($StringUtil.startsWithIgnoreCase($name, 'is'))
#set($name = $StringUtil.decapitalize($name))
#else
is##
#end
#else
get##
#end
${name}() {
return $field.name;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment