mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 17:00:05 +08:00
21 lines
823 B
Smarty
21 lines
823 B
Smarty
|
function! s:__class_exception(class, options)
|
||
|
let result = "package ". a:options.package .";\n\n"
|
||
|
let result .= "public class ". a:options.name
|
||
|
if has_key(a:options, 'extends')
|
||
|
let result .= " extends ". a:options['extends']
|
||
|
else
|
||
|
let result .= " extends Exception"
|
||
|
endif
|
||
|
if has_key(a:options, 'implements')
|
||
|
let result .= " implements ". a:options['implements']
|
||
|
endif
|
||
|
let result .= " {\n"
|
||
|
for fieldKey in keys(get(a:options, 'fields', {}))
|
||
|
let field = a:options['fields'][fieldKey]
|
||
|
let result .= field['mod']. " ". field['type']. " ". field['name']. ";\n"
|
||
|
endfor
|
||
|
let result .= "\npublic ". a:options.name. "() {\n\n}\n"
|
||
|
let result .= "\npublic ". a:options.name. "(String msg) {\nsuper(msg);\n}\n"
|
||
|
return result . "\n}"
|
||
|
endfunction
|