ServiceInterfaceFile.java
2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package com.brframework.generate.template;
import com.brframework.generate.BaseUtil;
import com.brframework.generate.Constant;
import com.brframework.generate.base.JavaFile;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
/**
* @Author: ljr
* @Date: 2019/8/15 10:37
* @Description:
*/
public class ServiceInterfaceFile extends JavaFile {
public ServiceInterfaceFile(String route, String packageDir, String entity, String function, Map<String, String> notes) {
fileDir = route + "/" + Constant.PACKAGE_SERVICE + "/" + function;
packageDir = BaseUtil.toPackage(packageDir);
String className = BaseUtil.getClassWithoutSuffix(entity);
fileName = BaseUtil.getClassWithModule(entity, Constant.MODULE_SERVICE) + Constant.SUFFIX_CLASS_TYPE;
filePackageName = packageDir + "." + Constant.PACKAGE_SERVICE + "." + function;
type = Constant.INTERFACE_TYPE;
name = BaseUtil.getClassWithModule(entity, Constant.MODULE_SERVICE );
String extendsService = "EntityService";
List<String> imports = getImports(packageDir, function, entity, extendsService);
List<String> classAnnotations = getClassAnnotations();
List<String> extendss = getExtendss(extendsService, className);
List<String> implementss = getImplementss();
List<Field> fields = getFields();
List<Method> methods = getMethods();
super.init(imports, notes, classAnnotations, extendss, implementss, fields, methods);
}
public List<String> getImports(String mainPackage, String function, String entity, String extendsService){
List<String> imports = new LinkedList<>();
imports.add(BaseUtil.getImportName(mainPackage, function, entity, Constant.PACKAGE_ENTITY).toString());
imports.add("com.brframework.commondb.core." + extendsService);
return imports;
}
public List<String> getClassAnnotations(){
List<String> classAnnotations = new LinkedList<>();
return classAnnotations;
}
public List<String> getExtendss(String extendsService, String className){
List<String> extendss = new LinkedList<>();
extendss.add(extendsService + "<" + className +", Long, " + "Object>");
return extendss;
}
public List<String> getImplementss(){
List<String> implementss = new LinkedList<>();
return implementss;
}
public List<Field> getFields(){
List<Field> fields = new LinkedList<>();
return fields;
}
public List<Method> getMethods(){
List<Method> methods = new LinkedList<>();
//methods,lombok不需要方法
return methods;
}
}