1 /*
2 * Copyright 2009 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.osedu.org/licenses/ECL-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.kuali.student.contract.writer;
17
18 /**
19 *
20 * @author nwright
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 }