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 * Contains the configuration information of the container like 28 * Plugin. 29 * 30 * @version $Revision$ $Date$ 31 */ 32 @SuppressWarnings( "all" ) 33 public class ConfigurationContainer 34 implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker 35 { 36 37 //--------------------------/ 38 //- Class/Member Variables -/ 39 //--------------------------/ 40 41 /** 42 * 43 * 44 * Whether any configuration should be propagated 45 * to child POMs. Note: While the type 46 * of this field is <code>String</code> for 47 * technical reasons, the semantic type is actually 48 * <code>Boolean</code>. Default value is 49 * <code>true</code>. 50 * 51 * 52 */ 53 private String inherited; 54 55 /** 56 * 57 * 58 * <p>The configuration as DOM object.</p> 59 * <p>By default, every element content is trimmed, 60 * but starting with Maven 3.1.0, you can add 61 * <code>xml:space="preserve"</code> to elements 62 * you want to preserve whitespace.</p> 63 * <p>You can control how child POMs inherit 64 * configuration from parent POMs by adding 65 * <code>combine.children</code> 66 * or <code>combine.self</code> attributes to the 67 * children of the configuration element:</p> 68 * <ul> 69 * <li><code>combine.children</code>: available 70 * values are <code>merge</code> (default) and 71 * <code>append</code>,</li> 72 * <li><code>combine.self</code>: available values 73 * are <code>merge</code> (default) and 74 * <code>override</code>.</li> 75 * </ul> 76 * <p>See <a 77 * href="https://maven.apache.org/pom.html#Plugins">POM 78 * Reference documentation</a> and 79 * <a 80 * href="https://codehaus-plexus.github.io/plexus-utils/apidocs/org/codehaus/plexus/util/xml/Xpp3DomUtils.html">Xpp3DomUtils</a> 81 * for more information.</p> 82 * 83 * 84 */ 85 private Object configuration; 86 87 /** 88 * Field locations. 89 */ 90 private java.util.Map<Object, InputLocation> locations; 91 92 /** 93 * Field location. 94 */ 95 private InputLocation location; 96 97 /** 98 * Field inheritedLocation. 99 */ 100 private InputLocation inheritedLocation; 101 102 /** 103 * Field configurationLocation. 104 */ 105 private InputLocation configurationLocation; 106 107 108 //-----------/ 109 //- Methods -/ 110 //-----------/ 111 112 /** 113 * Method clone. 114 * 115 * @return ConfigurationContainer 116 */ 117 public ConfigurationContainer clone() 118 { 119 try 120 { 121 ConfigurationContainer copy = (ConfigurationContainer) super.clone(); 122 123 if ( this.configuration != null ) 124 { 125 copy.configuration = new org.codehaus.plexus.util.xml.Xpp3Dom( (org.codehaus.plexus.util.xml.Xpp3Dom) this.configuration ); 126 } 127 128 if ( copy.locations != null ) 129 { 130 copy.locations = new java.util.LinkedHashMap( copy.locations ); 131 } 132 133 return copy; 134 } 135 catch ( java.lang.Exception ex ) 136 { 137 throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName() 138 + " does not support clone()" ).initCause( ex ); 139 } 140 } //-- ConfigurationContainer clone() 141 142 /** 143 * Get <p>The configuration as DOM object.</p> 144 * <p>By default, every element content is trimmed, 145 * but starting with Maven 3.1.0, you can add 146 * <code>xml:space="preserve"</code> to elements 147 * you want to preserve whitespace.</p> 148 * <p>You can control how child POMs inherit 149 * configuration from parent POMs by adding 150 * <code>combine.children</code> 151 * or <code>combine.self</code> attributes to the 152 * children of the configuration element:</p> 153 * <ul> 154 * <li><code>combine.children</code>: available 155 * values are <code>merge</code> (default) and 156 * <code>append</code>,</li> 157 * <li><code>combine.self</code>: available values 158 * are <code>merge</code> (default) and 159 * <code>override</code>.</li> 160 * </ul> 161 * <p>See <a 162 * href="https://maven.apache.org/pom.html#Plugins">POM 163 * Reference documentation</a> and 164 * <a 165 * href="https://codehaus-plexus.github.io/plexus-utils/apidocs/org/codehaus/plexus/util/xml/Xpp3DomUtils.html">Xpp3DomUtils</a> 166 * for more information.</p> 167 * 168 * @return Object 169 */ 170 public Object getConfiguration() 171 { 172 return this.configuration; 173 } //-- Object getConfiguration() 174 175 /** 176 * Get whether any configuration should be propagated to child 177 * POMs. Note: While the type 178 * of this field is <code>String</code> for 179 * technical reasons, the semantic type is actually 180 * <code>Boolean</code>. Default value is 181 * <code>true</code>. 182 * 183 * @return String 184 */ 185 public String getInherited() 186 { 187 return this.inherited; 188 } //-- String getInherited() 189 190 /** 191 * 192 * 193 * @param key a key object. 194 * @return InputLocation 195 */ 196 public InputLocation getLocation( Object key ) 197 { 198 if ( key instanceof String ) 199 { 200 switch ( ( String ) key ) 201 { 202 case "" : 203 { 204 return this.location; 205 } 206 case "inherited" : 207 { 208 return inheritedLocation; 209 } 210 case "configuration" : 211 { 212 return configurationLocation; 213 } 214 default : 215 { 216 return getOtherLocation( key ); 217 } 218 } 219 } 220 else 221 { 222 return getOtherLocation( key ); 223 } 224 } //-- InputLocation getLocation( Object ) 225 226 /** 227 * 228 * 229 * @param key a key object. 230 * @param location a location object. 231 */ 232 public void setLocation( Object key, InputLocation location ) 233 { 234 if ( key instanceof String ) 235 { 236 switch ( ( String ) key ) 237 { 238 case "" : 239 { 240 this.location = location; 241 return; 242 } 243 case "inherited" : 244 { 245 inheritedLocation = location; 246 return; 247 } 248 case "configuration" : 249 { 250 configurationLocation = location; 251 return; 252 } 253 default : 254 { 255 setOtherLocation( key, location ); 256 return; 257 } 258 } 259 } 260 else 261 { 262 setOtherLocation( key, location ); 263 } 264 } //-- void setLocation( Object, InputLocation ) 265 266 /** 267 * 268 * 269 * @param key a key object. 270 * @param location a location object. 271 */ 272 public void setOtherLocation( Object key, InputLocation location ) 273 { 274 if ( location != null ) 275 { 276 if ( this.locations == null ) 277 { 278 this.locations = new java.util.LinkedHashMap<Object, InputLocation>(); 279 } 280 this.locations.put( key, location ); 281 } 282 } //-- void setOtherLocation( Object, InputLocation ) 283 284 /** 285 * 286 * 287 * @param key a key object. 288 * @return InputLocation 289 */ 290 private InputLocation getOtherLocation( Object key ) 291 { 292 return ( locations != null ) ? locations.get( key ) : null; 293 } //-- InputLocation getOtherLocation( Object ) 294 295 /** 296 * Set <p>The configuration as DOM object.</p> 297 * <p>By default, every element content is trimmed, 298 * but starting with Maven 3.1.0, you can add 299 * <code>xml:space="preserve"</code> to elements 300 * you want to preserve whitespace.</p> 301 * <p>You can control how child POMs inherit 302 * configuration from parent POMs by adding 303 * <code>combine.children</code> 304 * or <code>combine.self</code> attributes to the 305 * children of the configuration element:</p> 306 * <ul> 307 * <li><code>combine.children</code>: available 308 * values are <code>merge</code> (default) and 309 * <code>append</code>,</li> 310 * <li><code>combine.self</code>: available values 311 * are <code>merge</code> (default) and 312 * <code>override</code>.</li> 313 * </ul> 314 * <p>See <a 315 * href="https://maven.apache.org/pom.html#Plugins">POM 316 * Reference documentation</a> and 317 * <a 318 * href="https://codehaus-plexus.github.io/plexus-utils/apidocs/org/codehaus/plexus/util/xml/Xpp3DomUtils.html">Xpp3DomUtils</a> 319 * for more information.</p> 320 * 321 * @param configuration a configuration object. 322 */ 323 public void setConfiguration( Object configuration ) 324 { 325 this.configuration = configuration; 326 } //-- void setConfiguration( Object ) 327 328 /** 329 * Set whether any configuration should be propagated to child 330 * POMs. Note: While the type 331 * of this field is <code>String</code> for 332 * technical reasons, the semantic type is actually 333 * <code>Boolean</code>. Default value is 334 * <code>true</code>. 335 * 336 * @param inherited a inherited object. 337 */ 338 public void setInherited( String inherited ) 339 { 340 this.inherited = inherited; 341 } //-- void setInherited( String ) 342 343 344 345 public boolean isInherited() 346 { 347 return ( inherited != null ) ? Boolean.parseBoolean( inherited ) : true; 348 } 349 350 public void setInherited( boolean inherited ) 351 { 352 this.inherited = String.valueOf( inherited ); 353 } 354 355 private boolean inheritanceApplied = true; 356 357 public void unsetInheritanceApplied() 358 { 359 this.inheritanceApplied = false; 360 } 361 362 public boolean isInheritanceApplied() 363 { 364 return inheritanceApplied; 365 } 366 367 368 }