1 package org.springframework.roo.addon.maven;
2
3 import org.springframework.roo.support.style.ToStringCreator;
4 import org.springframework.roo.support.util.Assert;
5
6
7
8
9
10
11
12
13 public class Template implements Comparable<Template> {
14
15 private String template;
16
17 public static final Template STANDARD_PROJECT = new Template("standard-project-template.xml");
18 public static final Template ROO_ADDON_SIMPLE= new Template("roo-addon-simple-template.xml");
19
20 public Template(String location) {
21 Assert.notNull(location, "Location required");
22 this.template = location;
23 }
24
25 public String getLocation() {
26 return template;
27 }
28
29 public boolean isAddOn() {
30 return ROO_ADDON_SIMPLE.equals(this);
31 }
32
33 public final boolean equals(Object obj) {
34 return obj != null && obj instanceof Template && this.compareTo((Template) obj) == 0;
35 }
36
37 public final int compareTo(Template o) {
38 if (o == null)
39 return -1;
40 int result = this.template.compareTo(o.template);
41
42 return result;
43 }
44
45 public String toString() {
46 ToStringCreator tsc = new ToStringCreator(this);
47 tsc.append("location", template);
48 return tsc.toString();
49 }
50
51 public String getKey() {
52 return this.template;
53 }
54 }