1 package org.codehaus.modello.plugin.xsd.metadata;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import org.codehaus.modello.metadata.ModelMetadata;
20 import org.codehaus.modello.model.Version;
21 import org.codehaus.plexus.util.StringUtils;
22
23
24
25
26
27
28 public class XsdModelMetadata implements ModelMetadata {
29 public static final String ID = XsdModelMetadata.class.getName();
30
31 private String namespace;
32
33 private String targetNamespace;
34
35 public String getNamespace() {
36 return namespace;
37 }
38
39 public void setNamespace(String namespace) {
40 this.namespace = namespace;
41 }
42
43 public String getTargetNamespace() {
44 return targetNamespace;
45 }
46
47 public void setTargetNamespace(String targetNamespace) {
48 this.targetNamespace = targetNamespace;
49 }
50
51 public String getNamespace(Version version) {
52 String namespace = this.namespace;
53
54 if (version != null) {
55 namespace = StringUtils.replace(namespace, "${version}", version.toString());
56 }
57
58 return namespace;
59 }
60
61 public String getTargetNamespace(Version version) {
62 String targetNamespace = this.targetNamespace;
63
64 if (version != null) {
65 targetNamespace = StringUtils.replace(targetNamespace, "${version}", version.toString());
66 }
67
68 return targetNamespace;
69 }
70 }