Skip to content

Instantly share code, notes, and snippets.

View mrehan27's full-sized avatar
⛱️
Relaxing

Muhammad Rehan mrehan27

⛱️
Relaxing
View GitHub Profile
@mrehan27
mrehan27 / GetterTemplateAndroidStudio.groovy
Last active January 25, 2022 04:17
Getter and setter templates used for Android Studio that handle variables starting with m and Observable fields used with data binding
public ##
#if($field.modifierStatic)
static ##
#end
#set($isObservable = $StringUtil.startsWith($field.type, $'android.databinding.Observable'))
#if($isObservable)
#if($StringUtil.contains($field.type, $'<'))
$StringUtil.substringBefore($StringUtil.substringAfter($field.type, $"<"), $">") ##
#else
$StringUtil.toLowerCase($StringUtil.substringAfter($field.type, $".Observable")) ##