Coverage Report - org.apache.maven.model.PatternSet
 
Classes in this File Line Coverage Branch Coverage Complexity
PatternSet
0%
0/46
0%
0/28
2.273
 
 1  
 /*
 2  
  * $Id$
 3  
  */
 4  
 
 5  
 package org.apache.maven.model;
 6  
 
 7  
   //---------------------------------/
 8  
  //- Imported classes and packages -/
 9  
 //---------------------------------/
 10  
 
 11  
 import java.util.Date;
 12  
 
 13  
 /**
 14  
  * Definition of include or exclude patterns.
 15  
  * 
 16  
  * @version $Revision$ $Date$
 17  
  */
 18  0
 public class PatternSet implements java.io.Serializable {
 19  
 
 20  
 
 21  
       //--------------------------/
 22  
      //- Class/Member Variables -/
 23  
     //--------------------------/
 24  
 
 25  
     /**
 26  
      * Field includes.
 27  
      */
 28  
     private java.util.List includes;
 29  
 
 30  
     /**
 31  
      * Field excludes.
 32  
      */
 33  
     private java.util.List excludes;
 34  
 
 35  
 
 36  
       //-----------/
 37  
      //- Methods -/
 38  
     //-----------/
 39  
 
 40  
     /**
 41  
      * Method addExclude.
 42  
      * 
 43  
      * @param string
 44  
      */
 45  
     public void addExclude( String string )
 46  
     {
 47  0
         if ( !(string instanceof String) )
 48  
         {
 49  0
             throw new ClassCastException( "PatternSet.addExcludes(string) parameter must be instanceof " + String.class.getName() );
 50  
         }
 51  0
         getExcludes().add( string );
 52  0
     } //-- void addExclude( String ) 
 53  
 
 54  
     /**
 55  
      * Method addInclude.
 56  
      * 
 57  
      * @param string
 58  
      */
 59  
     public void addInclude( String string )
 60  
     {
 61  0
         if ( !(string instanceof String) )
 62  
         {
 63  0
             throw new ClassCastException( "PatternSet.addIncludes(string) parameter must be instanceof " + String.class.getName() );
 64  
         }
 65  0
         getIncludes().add( string );
 66  0
     } //-- void addInclude( String ) 
 67  
 
 68  
     /**
 69  
      * Method getExcludes.
 70  
      * 
 71  
      * @return java.util.List
 72  
      */
 73  
     public java.util.List getExcludes()
 74  
     {
 75  0
         if ( this.excludes == null )
 76  
         {
 77  0
             this.excludes = new java.util.ArrayList();
 78  
         }
 79  
     
 80  0
         return this.excludes;
 81  
     } //-- java.util.List getExcludes() 
 82  
 
 83  
     /**
 84  
      * Method getIncludes.
 85  
      * 
 86  
      * @return java.util.List
 87  
      */
 88  
     public java.util.List getIncludes()
 89  
     {
 90  0
         if ( this.includes == null )
 91  
         {
 92  0
             this.includes = new java.util.ArrayList();
 93  
         }
 94  
     
 95  0
         return this.includes;
 96  
     } //-- java.util.List getIncludes() 
 97  
 
 98  
     /**
 99  
      * Method removeExclude.
 100  
      * 
 101  
      * @param string
 102  
      */
 103  
     public void removeExclude( String string )
 104  
     {
 105  0
         if ( !(string instanceof String) )
 106  
         {
 107  0
             throw new ClassCastException( "PatternSet.removeExcludes(string) parameter must be instanceof " + String.class.getName() );
 108  
         }
 109  0
         getExcludes().remove( string );
 110  0
     } //-- void removeExclude( String ) 
 111  
 
 112  
     /**
 113  
      * Method removeInclude.
 114  
      * 
 115  
      * @param string
 116  
      */
 117  
     public void removeInclude( String string )
 118  
     {
 119  0
         if ( !(string instanceof String) )
 120  
         {
 121  0
             throw new ClassCastException( "PatternSet.removeIncludes(string) parameter must be instanceof " + String.class.getName() );
 122  
         }
 123  0
         getIncludes().remove( string );
 124  0
     } //-- void removeInclude( String ) 
 125  
 
 126  
     /**
 127  
      * Set 
 128  
      *             
 129  
      *             A list of patterns to exclude, e.g.
 130  
      * <code>**&#47;*.xml</code>
 131  
      *             
 132  
      *           
 133  
      * 
 134  
      * @param excludes
 135  
      */
 136  
     public void setExcludes( java.util.List excludes )
 137  
     {
 138  0
         this.excludes = excludes;
 139  0
     } //-- void setExcludes( java.util.List ) 
 140  
 
 141  
     /**
 142  
      * Set 
 143  
      *             
 144  
      *             A list of patterns to include, e.g.
 145  
      * <code>**&#47;*.xml</code>.
 146  
      *             
 147  
      *           
 148  
      * 
 149  
      * @param includes
 150  
      */
 151  
     public void setIncludes( java.util.List includes )
 152  
     {
 153  0
         this.includes = includes;
 154  0
     } //-- void setIncludes( java.util.List ) 
 155  
 
 156  
 
 157  
             
 158  
     /**
 159  
      * @see java.lang.Object#toString()
 160  
      */
 161  
     public String toString()
 162  
     {
 163  0
         StringBuffer sb = new StringBuffer();
 164  
 
 165  0
         sb.append("PatternSet [includes: {");
 166  0
         for (java.util.Iterator i = getIncludes().iterator(); i.hasNext(); )
 167  
         {
 168  0
             String str = (String) i.next();
 169  0
             sb.append(str).append(", ");
 170  0
         }
 171  0
         if (sb.substring(sb.length() - 2).equals(", ")) sb.delete(sb.length() - 2, sb.length());
 172  
 
 173  0
         sb.append("}, excludes: {");
 174  0
         for (java.util.Iterator i = getExcludes().iterator(); i.hasNext(); )
 175  
         {
 176  0
             String str = (String) i.next();
 177  0
             sb.append(str).append(", ");
 178  0
         }
 179  0
         if (sb.substring(sb.length() - 2).equals(", ")) sb.delete(sb.length() - 2, sb.length());
 180  
 
 181  0
         sb.append("}]");
 182  0
         return sb.toString();
 183  
     }
 184  
             
 185  
           
 186  0
     private String modelEncoding = "UTF-8";
 187  
 
 188  
     /**
 189  
      * Set an encoding used for reading/writing the model.
 190  
      *
 191  
      * @param modelEncoding the encoding used when reading/writing the model.
 192  
      */
 193  
     public void setModelEncoding( String modelEncoding )
 194  
     {
 195  0
         this.modelEncoding = modelEncoding;
 196  0
     }
 197  
 
 198  
     /**
 199  
      * @return the current encoding used when reading/writing this model.
 200  
      */
 201  
     public String getModelEncoding()
 202  
     {
 203  0
         return modelEncoding;
 204  
     }
 205  
 }