View Javadoc
1   // =================== DO NOT EDIT THIS FILE ====================
2   // Generated by Modello 2.1.2,
3   // any modifications will be overwritten.
4   // ==============================================================
5   
6   package org.apache.maven.model;
7   
8   /**
9    * Definition of include or exclude patterns.
10   * 
11   * @version $Revision$ $Date$
12   */
13  @SuppressWarnings( "all" )
14  public class PatternSet
15      implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
16  {
17  
18        //--------------------------/
19       //- Class/Member Variables -/
20      //--------------------------/
21  
22      /**
23       * Field includes.
24       */
25      private java.util.List<String> includes;
26  
27      /**
28       * Field excludes.
29       */
30      private java.util.List<String> excludes;
31  
32      /**
33       * Field locations.
34       */
35      private java.util.Map<Object, InputLocation> locations;
36  
37      /**
38       * Field location.
39       */
40      private InputLocation location;
41  
42      /**
43       * Field includesLocation.
44       */
45      private InputLocation includesLocation;
46  
47      /**
48       * Field excludesLocation.
49       */
50      private InputLocation excludesLocation;
51  
52  
53        //-----------/
54       //- Methods -/
55      //-----------/
56  
57      /**
58       * Method addExclude.
59       * 
60       * @param string a string object.
61       */
62      public void addExclude( String string )
63      {
64          getExcludes().add( string );
65      } //-- void addExclude( String )
66  
67      /**
68       * Method addInclude.
69       * 
70       * @param string a string object.
71       */
72      public void addInclude( String string )
73      {
74          getIncludes().add( string );
75      } //-- void addInclude( String )
76  
77      /**
78       * Method clone.
79       * 
80       * @return PatternSet
81       */
82      public PatternSet clone()
83      {
84          try
85          {
86              PatternSet copy = (PatternSet) super.clone();
87  
88              if ( this.includes != null )
89              {
90                  copy.includes = new java.util.ArrayList<String>();
91                  copy.includes.addAll( this.includes );
92              }
93  
94              if ( this.excludes != null )
95              {
96                  copy.excludes = new java.util.ArrayList<String>();
97                  copy.excludes.addAll( this.excludes );
98              }
99  
100             if ( copy.locations != null )
101             {
102                 copy.locations = new java.util.LinkedHashMap( copy.locations );
103             }
104 
105             return copy;
106         }
107         catch ( java.lang.Exception ex )
108         {
109             throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
110                 + " does not support clone()" ).initCause( ex );
111         }
112     } //-- PatternSet clone()
113 
114     /**
115      * Method getExcludes.
116      * 
117      * @return List
118      */
119     public java.util.List<String> getExcludes()
120     {
121         if ( this.excludes == null )
122         {
123             this.excludes = new java.util.ArrayList<String>();
124         }
125 
126         return this.excludes;
127     } //-- java.util.List<String> getExcludes()
128 
129     /**
130      * Method getIncludes.
131      * 
132      * @return List
133      */
134     public java.util.List<String> getIncludes()
135     {
136         if ( this.includes == null )
137         {
138             this.includes = new java.util.ArrayList<String>();
139         }
140 
141         return this.includes;
142     } //-- java.util.List<String> getIncludes()
143 
144     /**
145      * 
146      * 
147      * @param key a key object.
148      * @return InputLocation
149      */
150     public InputLocation getLocation( Object key )
151     {
152         if ( key instanceof String )
153         {
154             switch ( ( String ) key )
155             {
156                 case "" :
157                 {
158                     return this.location;
159                 }
160                 case "includes" :
161                 {
162                     return includesLocation;
163                 }
164                 case "excludes" :
165                 {
166                     return excludesLocation;
167                 }
168                 default :
169                 {
170                     return getOtherLocation( key );
171                 }
172                 }
173             }
174             else
175             {
176                 return getOtherLocation( key );
177             }
178     } //-- InputLocation getLocation( Object )
179 
180     /**
181      * 
182      * 
183      * @param key a key object.
184      * @param location a location object.
185      */
186     public void setLocation( Object key, InputLocation location )
187     {
188         if ( key instanceof String )
189         {
190             switch ( ( String ) key )
191             {
192                 case "" :
193                 {
194                     this.location = location;
195                     return;
196                 }
197                 case "includes" :
198                 {
199                     includesLocation = location;
200                     return;
201                 }
202                 case "excludes" :
203                 {
204                     excludesLocation = location;
205                     return;
206                 }
207                 default :
208                 {
209                     setOtherLocation( key, location );
210                     return;
211                 }
212             }
213         }
214         else
215         {
216             setOtherLocation( key, location );
217         }
218     } //-- void setLocation( Object, InputLocation )
219 
220     /**
221      * 
222      * 
223      * @param key a key object.
224      * @param location a location object.
225      */
226     public void setOtherLocation( Object key, InputLocation location )
227     {
228         if ( location != null )
229         {
230             if ( this.locations == null )
231             {
232                 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
233             }
234             this.locations.put( key, location );
235         }
236     } //-- void setOtherLocation( Object, InputLocation )
237 
238     /**
239      * 
240      * 
241      * @param key a key object.
242      * @return InputLocation
243      */
244     private InputLocation getOtherLocation( Object key )
245     {
246         return ( locations != null ) ? locations.get( key ) : null;
247     } //-- InputLocation getOtherLocation( Object )
248 
249     /**
250      * Method removeExclude.
251      * 
252      * @param string a string object.
253      */
254     public void removeExclude( String string )
255     {
256         getExcludes().remove( string );
257     } //-- void removeExclude( String )
258 
259     /**
260      * Method removeInclude.
261      * 
262      * @param string a string object.
263      */
264     public void removeInclude( String string )
265     {
266         getIncludes().remove( string );
267     } //-- void removeInclude( String )
268 
269     /**
270      * Set a list of patterns to exclude, e.g.
271      * <code>**&#47;*.xml</code>
272      * 
273      * @param excludes a excludes object.
274      */
275     public void setExcludes( java.util.List<String> excludes )
276     {
277         this.excludes = excludes;
278     } //-- void setExcludes( java.util.List )
279 
280     /**
281      * Set a list of patterns to include, e.g.
282      * <code>**&#47;*.xml</code>.
283      * 
284      * @param includes a includes object.
285      */
286     public void setIncludes( java.util.List<String> includes )
287     {
288         this.includes = includes;
289     } //-- void setIncludes( java.util.List )
290 
291     
292             
293     /**
294      * @see java.lang.Object#toString()
295      */
296     public String toString()
297     {
298         StringBuilder sb = new StringBuilder( 128 );
299 
300         sb.append("PatternSet [includes: {");
301         for (java.util.Iterator i = getIncludes().iterator(); i.hasNext(); )
302         {
303             String str = (String) i.next();
304             sb.append(str).append(", ");
305         }
306         if (sb.substring(sb.length() - 2).equals(", ")) sb.delete(sb.length() - 2, sb.length());
307 
308         sb.append("}, excludes: {");
309         for (java.util.Iterator i = getExcludes().iterator(); i.hasNext(); )
310         {
311             String str = (String) i.next();
312             sb.append(str).append(", ");
313         }
314         if (sb.substring(sb.length() - 2).equals(", ")) sb.delete(sb.length() - 2, sb.length());
315 
316         sb.append("}]");
317         return sb.toString();
318     }
319             
320           
321 }