1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package nl.toolforge.karma.core.module.template;
20
21 import java.io.File;
22
23 /***
24 * Specifies the location of a template and the file where it should be copied to. These
25 * locations need to be absolute paths.
26 *
27 * @author W.H. Schraal
28 */
29 public class FileTemplate {
30
31 static final String SOURCE_IS_NULL = "The source location of a template may not be null.";
32 static final String TARGET_IS_NULL = "The target location of a template may not be null.";
33
34 /*** The relative location (including the file name) of the template. */
35 private File source;
36 /*** The absolute target location (including file name) of the template. */
37 private File target;
38
39 /***
40 * Create a FileTemplate object that specifies the source and target location
41 * of a template. This information can be used to copy a template to a target location.
42 *
43 * @param source Location of the template. May not be null.
44 * @param target Target location of the template, relative. May not be null.
45 */
46 public FileTemplate(File source, File target) {
47 if (source == null) {
48 throw new IllegalArgumentException(SOURCE_IS_NULL);
49 }
50 if (target == null) {
51 throw new IllegalArgumentException(TARGET_IS_NULL);
52 }
53 this.source = source;
54 this.target = target;
55 }
56
57 /***
58 * Retrieve the source location of the template.
59 * @return Non-null and existing File
60 */
61 public File getSource() {
62 return this.source;
63 }
64
65 /***
66 * Retrieve the target location of the template.
67 * @return non-null, but not necessarily existing File.
68 */
69 public File getTarget() {
70 return this.target;
71 }
72
73 }