001 // =================== DO NOT EDIT THIS FILE ====================
002 // Generated by Modello 1.7,
003 // any modifications will be overwritten.
004 // ==============================================================
005
006 package org.apache.maven.model;
007
008 /**
009 * Definition of include or exclude patterns.
010 *
011 * @version $Revision$ $Date$
012 */
013 @SuppressWarnings( "all" )
014 public class PatternSet
015 implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
016 {
017
018 //--------------------------/
019 //- Class/Member Variables -/
020 //--------------------------/
021
022 /**
023 * Field includes.
024 */
025 private java.util.List<String> includes;
026
027 /**
028 * Field excludes.
029 */
030 private java.util.List<String> excludes;
031
032 /**
033 * Field locations.
034 */
035 private java.util.Map<Object, InputLocation> locations;
036
037
038 //-----------/
039 //- Methods -/
040 //-----------/
041
042 /**
043 * Method addExclude.
044 *
045 * @param string
046 */
047 public void addExclude( String string )
048 {
049 getExcludes().add( string );
050 } //-- void addExclude( String )
051
052 /**
053 * Method addInclude.
054 *
055 * @param string
056 */
057 public void addInclude( String string )
058 {
059 getIncludes().add( string );
060 } //-- void addInclude( String )
061
062 /**
063 * Method clone.
064 *
065 * @return PatternSet
066 */
067 public PatternSet clone()
068 {
069 try
070 {
071 PatternSet copy = (PatternSet) super.clone();
072
073 if ( this.includes != null )
074 {
075 copy.includes = new java.util.ArrayList<String>();
076 copy.includes.addAll( this.includes );
077 }
078
079 if ( this.excludes != null )
080 {
081 copy.excludes = new java.util.ArrayList<String>();
082 copy.excludes.addAll( this.excludes );
083 }
084
085 if ( copy.locations != null )
086 {
087 copy.locations = new java.util.LinkedHashMap( copy.locations );
088 }
089
090 return copy;
091 }
092 catch ( java.lang.Exception ex )
093 {
094 throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
095 + " does not support clone()" ).initCause( ex );
096 }
097 } //-- PatternSet clone()
098
099 /**
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>**/*.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>**/*.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 }