Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
JavaClassFileNameBuilder |
|
| 1.3333333333333333;1.333 |
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 | ||
25 | private String rootDirectory; | |
26 | private String packageName; | |
27 | private String className; | |
28 | ||
29 | public JavaClassFileNameBuilder (String rootDirectory, | |
30 | String packageName, | |
31 | String className) | |
32 | 0 | { |
33 | 0 | this.rootDirectory = rootDirectory; |
34 | 0 | this.packageName = packageName; |
35 | 0 | this.className = className; |
36 | 0 | } |
37 | ||
38 | ||
39 | public String buildDirectory () | |
40 | { | |
41 | 0 | String dirName = rootDirectory; |
42 | 0 | if ( ! dirName.endsWith ("/")) |
43 | { | |
44 | 0 | dirName += "/"; |
45 | } | |
46 | 0 | dirName += packageName.replace (".", "/"); |
47 | 0 | return dirName; |
48 | } | |
49 | ||
50 | public String build () | |
51 | { | |
52 | 0 | String fileName = buildDirectory (); |
53 | 0 | fileName += "/" + className; |
54 | 0 | fileName += ".java"; |
55 | 0 | return fileName; |
56 | } | |
57 | } |