SSR - Structural Search and Replace problem

I am trying to convert the following code

    public void setNameRule(String nameRule) {
        this.nameRule = nameRule;
    }

to

    public void setNameRule(String nameRule) {
        Object oldValue = getNameRule();
        this.nameRule = nameRule;
        firePropertyChange("nameRule", oldValue, nameRule);
    }

I have tried many things but can't get anything to work. I thought I had one that converted getter methods to null safe and that is not working it is:

Search:
    public String $MethodName$() {
        return this.$Field$;
    }

Replace:
   public String $MethodName$() {
        if (this.$Field$ != null) {
            return this.$Field$;
        } else {
            return "";
        }
    }
And I keep getting that nothing matches even though I have methods like

    public String getCitation() {
        return this.citation;
    }

All of this is because I need null safe getters and setters that fire a property change event.

Any insight is much appreciated.

Please sign in to leave a comment.