1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.contract.writer;
17
18
19
20
21
22 public class JavaClassFileNameBuilder {
23
24 private String rootDirectory;
25 private String packageName;
26 private String className;
27
28 public JavaClassFileNameBuilder(String rootDirectory,
29 String packageName,
30 String className) {
31 this.rootDirectory = rootDirectory;
32 this.packageName = packageName;
33 this.className = className;
34 }
35
36 public String buildDirectory() {
37 String dirName = rootDirectory;
38 if (!dirName.endsWith("/")) {
39 dirName += "/";
40 }
41 dirName += packageName.replace(".", "/");
42 return dirName;
43 }
44
45 public String build() {
46 String fileName = buildDirectory();
47 fileName += "/" + className;
48 fileName += ".java";
49 return fileName;
50 }
51 }