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 {
30 public static final String ID = XsdModelMetadata.class.getName();
31
32 private String namespace;
33
34 private String targetNamespace;
35
36 public String getNamespace()
37 {
38 return namespace;
39 }
40
41 public void setNamespace( String namespace )
42 {
43 this.namespace = namespace;
44 }
45
46 public String getTargetNamespace()
47 {
48 return targetNamespace;
49 }
50
51 public void setTargetNamespace( String targetNamespace )
52 {
53 this.targetNamespace = targetNamespace;
54 }
55
56 public String getNamespace( Version version )
57 {
58 String namespace = this.namespace;
59
60 if ( version != null )
61 {
62 namespace = StringUtils.replace( namespace, "${version}", version.toString() );
63 }
64
65 return namespace;
66 }
67
68 public String getTargetNamespace( Version version )
69 {
70 String targetNamespace = this.targetNamespace;
71
72 if ( version != null )
73 {
74 targetNamespace = StringUtils.replace( targetNamespace, "${version}", version.toString() );
75 }
76
77 return targetNamespace;
78 }
79 }