View Javadoc
1   // =================== DO NOT EDIT THIS FILE ====================
2   // Generated by Modello 1.8.1,
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        //-----------/
39       //- Methods -/
40      //-----------/
41  
42      /**
43       * Method addExclude.
44       * 
45       * @param string
46       */
47      public void addExclude( String string )
48      {
49          getExcludes().add( string );
50      } //-- void addExclude( String )
51  
52      /**
53       * Method addInclude.
54       * 
55       * @param string
56       */
57      public void addInclude( String string )
58      {
59          getIncludes().add( string );
60      } //-- void addInclude( String )
61  
62      /**
63       * Method clone.
64       * 
65       * @return PatternSet
66       */
67      public PatternSet clone()
68      {
69          try
70          {
71              PatternSet copy = (PatternSet) super.clone();
72  
73              if ( this.includes != null )
74              {
75                  copy.includes = new java.util.ArrayList<String>();
76                  copy.includes.addAll( this.includes );
77              }
78  
79              if ( this.excludes != null )
80              {
81                  copy.excludes = new java.util.ArrayList<String>();
82                  copy.excludes.addAll( this.excludes );
83              }
84  
85              if ( copy.locations != null )
86              {
87                  copy.locations = new java.util.LinkedHashMap( copy.locations );
88              }
89  
90              return copy;
91          }
92          catch ( java.lang.Exception ex )
93          {
94              throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
95                  + " does not support clone()" ).initCause( ex );
96          }
97      } //-- PatternSet clone()
98  
99      /**
100      * Method getExcludes.
101      * 
102      * @return List
103      */
104     public java.util.List<String> getExcludes()
105     {
106         if ( this.excludes == null )
107         {
108             this.excludes = new java.util.ArrayList<String>();
109         }
110 
111         return this.excludes;
112     } //-- java.util.List<String> getExcludes()
113 
114     /**
115      * Method getIncludes.
116      * 
117      * @return List
118      */
119     public java.util.List<String> getIncludes()
120     {
121         if ( this.includes == null )
122         {
123             this.includes = new java.util.ArrayList<String>();
124         }
125 
126         return this.includes;
127     } //-- java.util.List<String> getIncludes()
128 
129     /**
130      * 
131      * 
132      * @param key
133      * @return InputLocation
134      */
135     public InputLocation getLocation( Object key )
136     {
137         return ( locations != null ) ? locations.get( key ) : null;
138     } //-- InputLocation getLocation( Object )
139 
140     /**
141      * Method removeExclude.
142      * 
143      * @param string
144      */
145     public void removeExclude( String string )
146     {
147         getExcludes().remove( string );
148     } //-- void removeExclude( String )
149 
150     /**
151      * Method removeInclude.
152      * 
153      * @param string
154      */
155     public void removeInclude( String string )
156     {
157         getIncludes().remove( string );
158     } //-- void removeInclude( String )
159 
160     /**
161      * Set a list of patterns to exclude, e.g.
162      * <code>**&#47;*.xml</code>
163      * 
164      * @param excludes
165      */
166     public void setExcludes( java.util.List<String> excludes )
167     {
168         this.excludes = excludes;
169     } //-- void setExcludes( java.util.List )
170 
171     /**
172      * Set a list of patterns to include, e.g.
173      * <code>**&#47;*.xml</code>.
174      * 
175      * @param includes
176      */
177     public void setIncludes( java.util.List<String> includes )
178     {
179         this.includes = includes;
180     } //-- void setIncludes( java.util.List )
181 
182     /**
183      * 
184      * 
185      * @param key
186      * @param location
187      */
188     public void setLocation( Object key, InputLocation location )
189     {
190         if ( location != null )
191         {
192             if ( this.locations == null )
193             {
194                 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
195             }
196             this.locations.put( key, location );
197         }
198     } //-- void setLocation( Object, InputLocation )
199 
200     
201             
202     /**
203      * @see java.lang.Object#toString()
204      */
205     public String toString()
206     {
207         StringBuilder sb = new StringBuilder( 128 );
208 
209         sb.append("PatternSet [includes: {");
210         for (java.util.Iterator i = getIncludes().iterator(); i.hasNext(); )
211         {
212             String str = (String) i.next();
213             sb.append(str).append(", ");
214         }
215         if (sb.substring(sb.length() - 2).equals(", ")) sb.delete(sb.length() - 2, sb.length());
216 
217         sb.append("}, excludes: {");
218         for (java.util.Iterator i = getExcludes().iterator(); i.hasNext(); )
219         {
220             String str = (String) i.next();
221             sb.append(str).append(", ");
222         }
223         if (sb.substring(sb.length() - 2).equals(", ")) sb.delete(sb.length() - 2, sb.length());
224 
225         sb.append("}]");
226         return sb.toString();
227     }
228             
229           
230 }