Update custom service generator
This commit is contained in:
parent
00075b07cd
commit
96f2955e94
1 changed files with 7 additions and 4 deletions
|
@ -12,13 +12,16 @@ class CustomServiceGenerator extends ServiceGenerator {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void applyToLibrary(LibraryBuilder library, String name, String lower) {
|
void applyToLibrary(LibraryBuilder library, String name, String lower) {
|
||||||
var clazz = new ClassBuilder('${name}Service', asExtends: new TypeBuilder('Service'));
|
library.body.add(new Class((clazz) {
|
||||||
library.addMember(clazz);
|
clazz
|
||||||
|
..name = '${name}Service'
|
||||||
|
..extend = refer('Service');
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ExpressionBuilder createInstance(
|
Expression createInstance(
|
||||||
MethodBuilder methodBuilder, String name, String lower) {
|
MethodBuilder methodBuilder, String name, String lower) {
|
||||||
return new TypeBuilder('${name}Service').newInstance([]);
|
return refer('${name}Service').newInstance([]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue