Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
Resource |
|
| 1.125;1,125 |
1 | /* | |
2 | =================== DO NOT EDIT THIS FILE ==================== | |
3 | Generated by Modello 1.0.1 on 2009-03-28 16:09:53, | |
4 | any modifications will be overwritten. | |
5 | ============================================================== | |
6 | */ | |
7 | ||
8 | package org.apache.maven.model; | |
9 | ||
10 | /** | |
11 | * This element describes all of the classpath resources associated | |
12 | * with a project | |
13 | * or unit tests. | |
14 | * | |
15 | * @version $Revision$ $Date$ | |
16 | */ | |
17 | 4 | public class Resource |
18 | extends FileSet | |
19 | implements java.io.Serializable | |
20 | { | |
21 | ||
22 | //--------------------------/ | |
23 | //- Class/Member Variables -/ | |
24 | //--------------------------/ | |
25 | ||
26 | /** | |
27 | * | |
28 | * | |
29 | * Describe the resource target path. The path is | |
30 | * relative to the target/classes | |
31 | * directory (i.e. | |
32 | * <code>${project.build.outputDirectory}</code>). | |
33 | * For example, if you want that resource to appear | |
34 | * in a specific package | |
35 | * (<code>org.apache.maven.messages</code>), you | |
36 | * must specify this | |
37 | * element with this value: | |
38 | * <code>org/apache/maven/messages</code>. | |
39 | * This is not required if you simply put the | |
40 | * resources in that directory | |
41 | * structure at the source, however. | |
42 | * | |
43 | * | |
44 | */ | |
45 | private String targetPath; | |
46 | ||
47 | /** | |
48 | * | |
49 | * | |
50 | * Whether resources are filtered to replace tokens | |
51 | * with parameterised values or not. | |
52 | * The values are taken from the | |
53 | * <code>properties</code> element and from the | |
54 | * properties in the files listed in the | |
55 | * <code>filters</code> element. | |
56 | * | |
57 | * | |
58 | */ | |
59 | 4 | private boolean filtering = false; |
60 | ||
61 | /** | |
62 | * | |
63 | * | |
64 | * FOR INTERNAL USE ONLY. This is a unique | |
65 | * identifier assigned to each | |
66 | * resource to allow Maven to merge changes to this | |
67 | * resource that take | |
68 | * place during the execution of a plugin. This | |
69 | * field must be managed | |
70 | * by the generated parser and formatter classes in | |
71 | * order to allow it | |
72 | * to survive model interpolation. | |
73 | * | |
74 | * | |
75 | */ | |
76 | private String mergeId; | |
77 | ||
78 | ||
79 | //-----------/ | |
80 | //- Methods -/ | |
81 | //-----------/ | |
82 | ||
83 | /** | |
84 | * Get fOR INTERNAL USE ONLY. This is a unique identifier | |
85 | * assigned to each | |
86 | * resource to allow Maven to merge changes to this | |
87 | * resource that take | |
88 | * place during the execution of a plugin. This | |
89 | * field must be managed | |
90 | * by the generated parser and formatter classes in | |
91 | * order to allow it | |
92 | * to survive model interpolation. | |
93 | * | |
94 | * @return String | |
95 | */ | |
96 | public String getMergeId() | |
97 | { | |
98 | 0 | return this.mergeId; |
99 | } //-- String getMergeId() | |
100 | ||
101 | /** | |
102 | * Get describe the resource target path. The path is relative | |
103 | * to the target/classes | |
104 | * directory (i.e. | |
105 | * <code>${project.build.outputDirectory}</code>). | |
106 | * For example, if you want that resource to appear | |
107 | * in a specific package | |
108 | * (<code>org.apache.maven.messages</code>), you | |
109 | * must specify this | |
110 | * element with this value: | |
111 | * <code>org/apache/maven/messages</code>. | |
112 | * This is not required if you simply put the | |
113 | * resources in that directory | |
114 | * structure at the source, however. | |
115 | * | |
116 | * @return String | |
117 | */ | |
118 | public String getTargetPath() | |
119 | { | |
120 | 1 | return this.targetPath; |
121 | } //-- String getTargetPath() | |
122 | ||
123 | /** | |
124 | * Get whether resources are filtered to replace tokens with | |
125 | * parameterised values or not. | |
126 | * The values are taken from the | |
127 | * <code>properties</code> element and from the | |
128 | * properties in the files listed in the | |
129 | * <code>filters</code> element. | |
130 | * | |
131 | * @return boolean | |
132 | */ | |
133 | public boolean isFiltering() | |
134 | { | |
135 | 1 | return this.filtering; |
136 | } //-- boolean isFiltering() | |
137 | ||
138 | /** | |
139 | * Set whether resources are filtered to replace tokens with | |
140 | * parameterised values or not. | |
141 | * The values are taken from the | |
142 | * <code>properties</code> element and from the | |
143 | * properties in the files listed in the | |
144 | * <code>filters</code> element. | |
145 | * | |
146 | * @param filtering | |
147 | */ | |
148 | public void setFiltering( boolean filtering ) | |
149 | { | |
150 | 0 | this.filtering = filtering; |
151 | 0 | } //-- void setFiltering( boolean ) |
152 | ||
153 | /** | |
154 | * Set fOR INTERNAL USE ONLY. This is a unique identifier | |
155 | * assigned to each | |
156 | * resource to allow Maven to merge changes to this | |
157 | * resource that take | |
158 | * place during the execution of a plugin. This | |
159 | * field must be managed | |
160 | * by the generated parser and formatter classes in | |
161 | * order to allow it | |
162 | * to survive model interpolation. | |
163 | * | |
164 | * @param mergeId | |
165 | */ | |
166 | public void setMergeId( String mergeId ) | |
167 | { | |
168 | 0 | this.mergeId = mergeId; |
169 | 0 | } //-- void setMergeId( String ) |
170 | ||
171 | /** | |
172 | * Set describe the resource target path. The path is relative | |
173 | * to the target/classes | |
174 | * directory (i.e. | |
175 | * <code>${project.build.outputDirectory}</code>). | |
176 | * For example, if you want that resource to appear | |
177 | * in a specific package | |
178 | * (<code>org.apache.maven.messages</code>), you | |
179 | * must specify this | |
180 | * element with this value: | |
181 | * <code>org/apache/maven/messages</code>. | |
182 | * This is not required if you simply put the | |
183 | * resources in that directory | |
184 | * structure at the source, however. | |
185 | * | |
186 | * @param targetPath | |
187 | */ | |
188 | public void setTargetPath( String targetPath ) | |
189 | { | |
190 | 0 | this.targetPath = targetPath; |
191 | 0 | } //-- void setTargetPath( String ) |
192 | ||
193 | ||
194 | ||
195 | 1 | private static int mergeIdCounter = 0; |
196 | ||
197 | public void initMergeId() | |
198 | { | |
199 | 0 | if ( getMergeId() == null ) |
200 | { | |
201 | 0 | setMergeId( "resource-" + (mergeIdCounter++) ); |
202 | } | |
203 | 0 | } |
204 | ||
205 | /** | |
206 | * @see java.lang.Object#toString() | |
207 | */ | |
208 | public String toString() | |
209 | { | |
210 | 1 | return "Resource {targetPath: " + getTargetPath() + ", filtering: " + isFiltering() + ", " + super.toString() + "}"; |
211 | } | |
212 | ||
213 | ||
214 | } |