views:

36

answers:

0

Is anyone know how to set up a live template in intellij for doing specialized setters - i'm using v5, but I accept with pleasure knowledge for a more recent release) -

My first need is a firePropertyChange setter:

public final static String $PROPERTY$ = "$property$"
public void set$Property$($TYPE$ $property$) {
    Object oldValue = this.$property$;
    this.$property$ = $property$;
    firePropertyChange($PROPERTY$, oldValue, $property$);
}

I have a semi-working version that generate the implementation with variables defined like this: $property$ --> completeSmart() $PROPERTY$ --> completeSmart()

My second need is a builder style setter that call the regular setter and then return this after the set:

public $THIS_TYPE$ with$Property$($TYPE$ $property$) {
    set$Property$($property$); 
    return this;
}

For this one I have nothing really good: I still have to type a lot !

Any suggestion ?