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