1 /* 2 Licensed to the Apache Software Foundation (ASF) under one 3 or more contributor license agreements. See the NOTICE file 4 distributed with this work for additional information 5 regarding copyright ownership. The ASF licenses this file 6 to you under the Apache License, Version 2.0 (the 7 "License"); you may not use this file except in compliance 8 with the License. You may obtain a copy of the License at 9 10 http://www.apache.org/licenses/LICENSE-2.0 11 12 Unless required by applicable law or agreed to in writing, 13 software distributed under the License is distributed on an 14 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 KIND, either express or implied. See the License for the 16 specific language governing permissions and limitations 17 under the License. 18 =================== DO NOT EDIT THIS FILE ==================== 19 Generated by Modello 2.4.0, 20 any modifications will be overwritten. 21 ============================================================== 22 */ 23 24 package org.apache.maven.model; 25 26 /** 27 * This element describes all of the classpath resources associated 28 * with a project 29 * or unit tests. 30 * 31 * @version $Revision$ $Date$ 32 */ 33 @SuppressWarnings( "all" ) 34 public class Resource 35 extends FileSet 36 implements java.io.Serializable, java.lang.Cloneable 37 { 38 39 //--------------------------/ 40 //- Class/Member Variables -/ 41 //--------------------------/ 42 43 /** 44 * 45 * 46 * Describe the resource target path. The path is 47 * relative to the target/classes 48 * directory (i.e. 49 * <code>${project.build.outputDirectory}</code>). 50 * For example, if you want that resource to appear 51 * in a specific package 52 * (<code>org.apache.maven.messages</code>), you 53 * must specify this 54 * element with this value: 55 * <code>org/apache/maven/messages</code>. 56 * This is not required if you simply put the 57 * resources in that directory 58 * structure at the source, however. 59 * 60 * 61 */ 62 private String targetPath; 63 64 /** 65 * 66 * 67 * Whether resources are filtered to replace tokens 68 * with parameterised values or not. 69 * The values are taken from the 70 * <code>properties</code> element and from the 71 * properties in the files listed in the 72 * <code>filters</code> element. Note: While the type 73 * of this field is <code>String</code> for 74 * technical reasons, the semantic type is actually 75 * <code>Boolean</code>. Default value is 76 * <code>false</code>. 77 * 78 * 79 */ 80 private String filtering; 81 82 /** 83 * 84 * 85 * FOR INTERNAL USE ONLY. This is a unique 86 * identifier assigned to each 87 * resource to allow Maven to merge changes to this 88 * resource that take 89 * place during the execution of a plugin. This 90 * field must be managed 91 * by the generated parser and formatter classes in 92 * order to allow it 93 * to survive model interpolation. 94 * 95 * 96 */ 97 private String mergeId; 98 99 100 //-----------/ 101 //- Methods -/ 102 //-----------/ 103 104 /** 105 * Method clone. 106 * 107 * @return Resource 108 */ 109 public Resource clone() 110 { 111 try 112 { 113 Resource copy = (Resource) super.clone(); 114 115 return copy; 116 } 117 catch ( java.lang.Exception ex ) 118 { 119 throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName() 120 + " does not support clone()" ).initCause( ex ); 121 } 122 } //-- Resource clone() 123 124 /** 125 * Get whether resources are filtered to replace tokens with 126 * parameterised values or not. 127 * The values are taken from the 128 * <code>properties</code> element and from the 129 * properties in the files listed in the 130 * <code>filters</code> element. Note: While the type 131 * of this field is <code>String</code> for 132 * technical reasons, the semantic type is actually 133 * <code>Boolean</code>. Default value is 134 * <code>false</code>. 135 * 136 * @return String 137 */ 138 public String getFiltering() 139 { 140 return this.filtering; 141 } //-- String getFiltering() 142 143 /** 144 * Get fOR INTERNAL USE ONLY. This is a unique identifier 145 * assigned to each 146 * resource to allow Maven to merge changes to this 147 * resource that take 148 * place during the execution of a plugin. This 149 * field must be managed 150 * by the generated parser and formatter classes in 151 * order to allow it 152 * to survive model interpolation. 153 * 154 * @return String 155 */ 156 public String getMergeId() 157 { 158 return this.mergeId; 159 } //-- String getMergeId() 160 161 /** 162 * Get describe the resource target path. The path is relative 163 * to the target/classes 164 * directory (i.e. 165 * <code>${project.build.outputDirectory}</code>). 166 * For example, if you want that resource to appear 167 * in a specific package 168 * (<code>org.apache.maven.messages</code>), you 169 * must specify this 170 * element with this value: 171 * <code>org/apache/maven/messages</code>. 172 * This is not required if you simply put the 173 * resources in that directory 174 * structure at the source, however. 175 * 176 * @return String 177 */ 178 public String getTargetPath() 179 { 180 return this.targetPath; 181 } //-- String getTargetPath() 182 183 /** 184 * Set whether resources are filtered to replace tokens with 185 * parameterised values or not. 186 * The values are taken from the 187 * <code>properties</code> element and from the 188 * properties in the files listed in the 189 * <code>filters</code> element. Note: While the type 190 * of this field is <code>String</code> for 191 * technical reasons, the semantic type is actually 192 * <code>Boolean</code>. Default value is 193 * <code>false</code>. 194 * 195 * @param filtering a filtering object. 196 */ 197 public void setFiltering( String filtering ) 198 { 199 this.filtering = filtering; 200 } //-- void setFiltering( String ) 201 202 /** 203 * Set fOR INTERNAL USE ONLY. This is a unique identifier 204 * assigned to each 205 * resource to allow Maven to merge changes to this 206 * resource that take 207 * place during the execution of a plugin. This 208 * field must be managed 209 * by the generated parser and formatter classes in 210 * order to allow it 211 * to survive model interpolation. 212 * 213 * @param mergeId a mergeId object. 214 */ 215 public void setMergeId( String mergeId ) 216 { 217 this.mergeId = mergeId; 218 } //-- void setMergeId( String ) 219 220 /** 221 * Set describe the resource target path. The path is relative 222 * to the target/classes 223 * directory (i.e. 224 * <code>${project.build.outputDirectory}</code>). 225 * For example, if you want that resource to appear 226 * in a specific package 227 * (<code>org.apache.maven.messages</code>), you 228 * must specify this 229 * element with this value: 230 * <code>org/apache/maven/messages</code>. 231 * This is not required if you simply put the 232 * resources in that directory 233 * structure at the source, however. 234 * 235 * @param targetPath a targetPath object. 236 */ 237 public void setTargetPath( String targetPath ) 238 { 239 this.targetPath = targetPath; 240 } //-- void setTargetPath( String ) 241 242 243 244 private static int mergeIdCounter = 0; 245 246 public void initMergeId() 247 { 248 if ( getMergeId() == null ) 249 { 250 setMergeId( "resource-" + (mergeIdCounter++) ); 251 } 252 } 253 254 public boolean isFiltering() 255 { 256 return ( filtering != null ) ? Boolean.parseBoolean( filtering ) : false; 257 } 258 259 public void setFiltering( boolean filtering ) 260 { 261 this.filtering = String.valueOf( filtering ); 262 } 263 264 /** 265 * @see java.lang.Object#toString() 266 */ 267 public String toString() 268 { 269 return "Resource {targetPath: " + getTargetPath() + ", filtering: " + isFiltering() + ", " + super.toString() + "}"; 270 } 271 272 273 }