View Javadoc

1   /*
2    =================== DO NOT EDIT THIS FILE ====================
3    Generated by Modello 1.4.1 on 2012-01-20 18:05:12,
4    any modifications will be overwritten.
5    ==============================================================
6    */
7   
8   package org.apache.maven.model;
9   
10  /**
11   * Definition of include or exclude patterns.
12   * 
13   * @version $Revision$ $Date$
14   */
15  @SuppressWarnings( "all" )
16  public class PatternSet
17      implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
18  {
19  
20        //--------------------------/
21       //- Class/Member Variables -/
22      //--------------------------/
23  
24      /**
25       * Field includes.
26       */
27      private java.util.List<String> includes;
28  
29      /**
30       * Field excludes.
31       */
32      private java.util.List<String> excludes;
33  
34      /**
35       * Field locations.
36       */
37      private java.util.Map<Object, InputLocation> locations;
38  
39  
40        //-----------/
41       //- Methods -/
42      //-----------/
43  
44      /**
45       * Method addExclude.
46       * 
47       * @param string
48       */
49      public void addExclude( String string )
50      {
51          getExcludes().add( string );
52      } //-- void addExclude( String )
53  
54      /**
55       * Method addInclude.
56       * 
57       * @param string
58       */
59      public void addInclude( String string )
60      {
61          getIncludes().add( string );
62      } //-- void addInclude( String )
63  
64      /**
65       * Method clone.
66       * 
67       * @return PatternSet
68       */
69      public PatternSet clone()
70      {
71          try
72          {
73              PatternSet copy = (PatternSet) super.clone();
74  
75              if ( this.includes != null )
76              {
77                  copy.includes = new java.util.ArrayList<String>();
78                  copy.includes.addAll( this.includes );
79              }
80  
81              if ( this.excludes != null )
82              {
83                  copy.excludes = new java.util.ArrayList<String>();
84                  copy.excludes.addAll( this.excludes );
85              }
86  
87              if ( copy.locations != null )
88              {
89                  copy.locations = new java.util.LinkedHashMap( copy.locations );
90              }
91  
92              return copy;
93          }
94          catch ( java.lang.Exception ex )
95          {
96              throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
97                  + " does not support clone()" ).initCause( ex );
98          }
99      } //-- PatternSet clone()
100 
101     /**
102      * Method getExcludes.
103      * 
104      * @return List
105      */
106     public java.util.List<String> getExcludes()
107     {
108         if ( this.excludes == null )
109         {
110             this.excludes = new java.util.ArrayList<String>();
111         }
112 
113         return this.excludes;
114     } //-- java.util.List<String> getExcludes()
115 
116     /**
117      * Method getIncludes.
118      * 
119      * @return List
120      */
121     public java.util.List<String> getIncludes()
122     {
123         if ( this.includes == null )
124         {
125             this.includes = new java.util.ArrayList<String>();
126         }
127 
128         return this.includes;
129     } //-- java.util.List<String> getIncludes()
130 
131     /**
132      * 
133      * 
134      * @param key
135      * @return InputLocation
136      */
137     public InputLocation getLocation( Object key )
138     {
139         return ( locations != null ) ? locations.get( key ) : null;
140     } //-- InputLocation getLocation( Object )
141 
142     /**
143      * Method removeExclude.
144      * 
145      * @param string
146      */
147     public void removeExclude( String string )
148     {
149         getExcludes().remove( string );
150     } //-- void removeExclude( String )
151 
152     /**
153      * Method removeInclude.
154      * 
155      * @param string
156      */
157     public void removeInclude( String string )
158     {
159         getIncludes().remove( string );
160     } //-- void removeInclude( String )
161 
162     /**
163      * Set a list of patterns to exclude, e.g.
164      * <code>**&#47;*.xml</code>
165      * 
166      * @param excludes
167      */
168     public void setExcludes( java.util.List<String> excludes )
169     {
170         this.excludes = excludes;
171     } //-- void setExcludes( java.util.List )
172 
173     /**
174      * Set a list of patterns to include, e.g.
175      * <code>**&#47;*.xml</code>.
176      * 
177      * @param includes
178      */
179     public void setIncludes( java.util.List<String> includes )
180     {
181         this.includes = includes;
182     } //-- void setIncludes( java.util.List )
183 
184     /**
185      * 
186      * 
187      * @param key
188      * @param location
189      */
190     public void setLocation( Object key, InputLocation location )
191     {
192         if ( location != null )
193         {
194             if ( this.locations == null )
195             {
196                 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
197             }
198             this.locations.put( key, location );
199         }
200     } //-- void setLocation( Object, InputLocation )
201 
202     
203             
204     /**
205      * @see java.lang.Object#toString()
206      */
207     public String toString()
208     {
209         StringBuilder sb = new StringBuilder( 128 );
210 
211         sb.append("PatternSet [includes: {");
212         for (java.util.Iterator i = getIncludes().iterator(); i.hasNext(); )
213         {
214             String str = (String) i.next();
215             sb.append(str).append(", ");
216         }
217         if (sb.substring(sb.length() - 2).equals(", ")) sb.delete(sb.length() - 2, sb.length());
218 
219         sb.append("}, excludes: {");
220         for (java.util.Iterator i = getExcludes().iterator(); i.hasNext(); )
221         {
222             String str = (String) i.next();
223             sb.append(str).append(", ");
224         }
225         if (sb.substring(sb.length() - 2).equals(", ")) sb.delete(sb.length() - 2, sb.length());
226 
227         sb.append("}]");
228         return sb.toString();
229     }
230             
231           
232 }