View Javadoc
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 is the property specification used to activate a profile.
28   * If the value field
29   *         is empty, then the existence of the named property will
30   * activate the profile, otherwise it
31   *         does a case-sensitive match against the property value
32   * as well.
33   * 
34   * @version $Revision$ $Date$
35   */
36  @SuppressWarnings( "all" )
37  public class ActivationProperty
38      implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
39  {
40  
41        //--------------------------/
42       //- Class/Member Variables -/
43      //--------------------------/
44  
45      /**
46       * The name of the property to be used to activate a profile.
47       */
48      private String name;
49  
50      /**
51       * The value of the property required to activate a profile.
52       */
53      private String value;
54  
55      /**
56       * Field locations.
57       */
58      private java.util.Map<Object, InputLocation> locations;
59  
60      /**
61       * Field location.
62       */
63      private InputLocation location;
64  
65      /**
66       * Field nameLocation.
67       */
68      private InputLocation nameLocation;
69  
70      /**
71       * Field valueLocation.
72       */
73      private InputLocation valueLocation;
74  
75  
76        //-----------/
77       //- Methods -/
78      //-----------/
79  
80      /**
81       * Method clone.
82       * 
83       * @return ActivationProperty
84       */
85      public ActivationProperty clone()
86      {
87          try
88          {
89              ActivationProperty copy = (ActivationProperty) super.clone();
90  
91              if ( copy.locations != null )
92              {
93                  copy.locations = new java.util.LinkedHashMap( copy.locations );
94              }
95  
96              return copy;
97          }
98          catch ( java.lang.Exception ex )
99          {
100             throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
101                 + " does not support clone()" ).initCause( ex );
102         }
103     } //-- ActivationProperty clone()
104 
105     /**
106      * 
107      * 
108      * @param key a key object.
109      * @return InputLocation
110      */
111     public InputLocation getLocation( Object key )
112     {
113         if ( key instanceof String )
114         {
115             switch ( ( String ) key )
116             {
117                 case "" :
118                 {
119                     return this.location;
120                 }
121                 case "name" :
122                 {
123                     return nameLocation;
124                 }
125                 case "value" :
126                 {
127                     return valueLocation;
128                 }
129                 default :
130                 {
131                     return getOtherLocation( key );
132                 }
133                 }
134             }
135             else
136             {
137                 return getOtherLocation( key );
138             }
139     } //-- InputLocation getLocation( Object )
140 
141     /**
142      * Get the name of the property to be used to activate a
143      * profile.
144      * 
145      * @return String
146      */
147     public String getName()
148     {
149         return this.name;
150     } //-- String getName()
151 
152     /**
153      * 
154      * 
155      * @param key a key object.
156      * @param location a location object.
157      */
158     public void setLocation( Object key, InputLocation location )
159     {
160         if ( key instanceof String )
161         {
162             switch ( ( String ) key )
163             {
164                 case "" :
165                 {
166                     this.location = location;
167                     return;
168                 }
169                 case "name" :
170                 {
171                     nameLocation = location;
172                     return;
173                 }
174                 case "value" :
175                 {
176                     valueLocation = location;
177                     return;
178                 }
179                 default :
180                 {
181                     setOtherLocation( key, location );
182                     return;
183                 }
184             }
185         }
186         else
187         {
188             setOtherLocation( key, location );
189         }
190     } //-- void setLocation( Object, InputLocation )
191 
192     /**
193      * 
194      * 
195      * @param key a key object.
196      * @param location a location object.
197      */
198     public void setOtherLocation( Object key, InputLocation location )
199     {
200         if ( location != null )
201         {
202             if ( this.locations == null )
203             {
204                 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
205             }
206             this.locations.put( key, location );
207         }
208     } //-- void setOtherLocation( Object, InputLocation )
209 
210     /**
211      * 
212      * 
213      * @param key a key object.
214      * @return InputLocation
215      */
216     private InputLocation getOtherLocation( Object key )
217     {
218         return ( locations != null ) ? locations.get( key ) : null;
219     } //-- InputLocation getOtherLocation( Object )
220 
221     /**
222      * Get the value of the property required to activate a
223      * profile.
224      * 
225      * @return String
226      */
227     public String getValue()
228     {
229         return this.value;
230     } //-- String getValue()
231 
232     /**
233      * Set the name of the property to be used to activate a
234      * profile.
235      * 
236      * @param name a name object.
237      */
238     public void setName( String name )
239     {
240         this.name = name;
241     } //-- void setName( String )
242 
243     /**
244      * Set the value of the property required to activate a
245      * profile.
246      * 
247      * @param value a value object.
248      */
249     public void setValue( String value )
250     {
251         this.value = value;
252     } //-- void setValue( String )
253 
254 }