Created
March 2, 2017 10:42
-
-
Save Keshava11/6c57344a48646f515af77c327f716b6d to your computer and use it in GitHub Desktop.
Android Studio Setter template for member names starting with 'm' and 's' without 'm' and 's' in method name.
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
#set($paramName = $helper.getParamName($field, $project)) | |
public ## | |
#if($field.modifierStatic) | |
static ## | |
#end | |
#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)) | |
#if ($paramName.length() > 1 && ($StringUtil.startsWith($paramName, 'm') || $StringUtil.startsWith($paramName, 's'))) | |
#set($paramName = "i"+$paramName.substring(1)) | |
#end | |
#end | |
void set${name}($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