Merge pull request #329 from RyanPineo/master
Java: fix setter. camel case vars/types properly.
This commit is contained in:
commit
6de3bb7ccb
@ -25,8 +25,13 @@ def getArgs(group):
|
|||||||
return [i.split(" ") for i in word.findall(group) ]
|
return [i.split(" ") for i in word.findall(group) ]
|
||||||
|
|
||||||
def camel(word):
|
def camel(word):
|
||||||
|
if not word: return ''
|
||||||
return word[0].upper() + word[1:]
|
return word[0].upper() + word[1:]
|
||||||
|
|
||||||
|
def mixedCase(word):
|
||||||
|
if not word: return ''
|
||||||
|
return word[0].lower() + word[1:]
|
||||||
|
|
||||||
endglobal
|
endglobal
|
||||||
|
|
||||||
snippet sleep "try sleep catch" b
|
snippet sleep "try sleep catch" b
|
||||||
@ -338,23 +343,23 @@ endsnippet
|
|||||||
|
|
||||||
snippet /get(ter)?/ "getter" br
|
snippet /get(ter)?/ "getter" br
|
||||||
public ${1:String} get${2:Name}() {
|
public ${1:String} get${2:Name}() {
|
||||||
return `!p snip.rv = t[2].lower()`;
|
return `!p snip.rv = mixedCase(t[2])`;
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet /set(ter)?/ "setter" br
|
snippet /set(ter)?/ "setter" br
|
||||||
public void set${1:Name}(${2:String} $1) {
|
public void set${1:Name}(${2:String} `!p snip.rv = mixedCase(t[1])`) {
|
||||||
return this.`!p snip.rv = t[1].lower()` = `!p snip.rv = t[1].lower()`;
|
this.`!p snip.rv = mixedCase(t[1])` = `!p snip.rv = mixedCase(t[1])`;
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet /se?tge?t|ge?tse?t|gs/ "setter and getter" br
|
snippet /se?tge?t|ge?tse?t|gs/ "setter and getter" br
|
||||||
public void set${1:Name}(${2:String} `!p snip.rv = t[1].lower()`) {
|
public void set${1:Name}(${2:String} `!p snip.rv = mixedCase(t[1])`) {
|
||||||
this.`!p snip.rv = t[1].lower()` = `!p snip.rv = t[1].lower()`;
|
this.`!p snip.rv = mixedCase(t[1])` = `!p snip.rv = mixedCase(t[1])`;
|
||||||
}
|
}
|
||||||
|
|
||||||
public $2 get$1() {
|
public $2 get$1() {
|
||||||
return `!p snip.rv = t[1].lower()`;
|
return `!p snip.rv = mixedCase(t[1])`;
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user