Created
February 2, 2017 22:56
-
-
Save IhorKlimov/a14cf159838ac59dfc1da2ca230730ee to your computer and use it in GitHub Desktop.
Android Studio Getter/Setter Ignore m Prefix Templates
This file contains 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
#if($field.modifierStatic) | |
static ## | |
#end | |
$field.type ## | |
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project)))) | |
#if ($field.boolean && $field.primitive) | |
#if ($StringUtil.startsWithIgnoreCase($name, 'is')) | |
#set($name = $StringUtil.decapitalize($name)) | |
#else | |
is## | |
#end | |
#else | |
get## | |
#end | |
#if($StringUtil.startsWithIgnoreCase($name, 'm')) | |
#set($name = $name.substring(1, $name.length())) | |
#end | |
${name}() { | |
return $field.name; | |
} |
This file contains 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
#set($paramName = $helper.getParamName($field, $project)) | |
#if ($StringUtil.startsWithIgnoreCase($paramName, 'm')) | |
#set($paramName = $paramName.substring(1, 2).toLowerCase() + $paramName.substring(2, $$paramName.length())) | |
#end | |
#if($field.modifierStatic) | |
static ## | |
#end | |
#set($v = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project)))) | |
#if ($StringUtil.startsWithIgnoreCase($v, 'm')) | |
#set($v = $v.substring(1, $v.length())) | |
#end | |
void set$v($field.type $paramName) { | |
#if ($field.name == $paramName) | |
#if (!$field.modifierStatic) | |
this.## | |
#else | |
$classname.## | |
#end | |
#end | |
$field.name = $paramName; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment