Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
The ultimate getter/setter IntellijIDEA live template

Suggested abbrevation: getset

Applicable in Java » Declaration

The live template:

/**
 * Set $DESC$.
 * 
 * @param $P_NAME$ $CAP_DESC$
 */
public final void set$SET_NAME$(final $TYPE$ $P_NAME$) {
    $NAME$ = $P_NAME$;
}

/**
 * Get $DESC$.
 *
 * @return $CAP_DESC$
 */
public final $TYPE$ get$SET_NAME$() {
    return $NAME$;
}

$END$

The variables:

  • NAME - suggestFirstVariableName("Object") - Don't skip
  • TYPE - typeOfVariable(NAME) - Skip
  • DESC - underscoresToSpaces(snakeCase(NAME)) - Don't skip
  • CAP_DESC - capitalize(DESC) - Skip
  • SET_NAME - capitalize(NAME) - Skip
  • P_NAME - groovyScript("def result= _1.substring(0,1); return result;", NAME) - Skip
@tieorange

This comment has been minimized.

Copy link

commented May 5, 2016

thanks 👍
that was helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.