Coverage Report - org.apache.maven.shared.model.fileset.Mapper
 
Classes in this File Line Coverage Branch Coverage Complexity
Mapper
17%
3/18
N/A
1
 
 1  
 /*
 2  
  * $Id: org.apache.maven.shared.model.fileset.Mapper.html 886882 2013-11-16 21:55:43Z hboutemy $
 3  
  */
 4  
 
 5  
 package org.apache.maven.shared.model.fileset;
 6  
 
 7  
   //---------------------------------/
 8  
  //- Imported classes and packages -/
 9  
 //---------------------------------/
 10  
 
 11  
 import java.util.Date;
 12  
 
 13  
 /**
 14  
  * Class Mapper.
 15  
  * 
 16  
  * @version $Revision: 886882 $ $Date: 2013-11-16 21:55:43 +0000 (Sat, 16 Nov 2013) $
 17  
  */
 18  10
 public class Mapper implements java.io.Serializable {
 19  
 
 20  
 
 21  
       //--------------------------/
 22  
      //- Class/Member Variables -/
 23  
     //--------------------------/
 24  
 
 25  
     /**
 26  
      * 
 27  
      *             
 28  
      *             Specifies a built-in mapper implementation.
 29  
      *             <br/>
 30  
      *             Valid values:
 31  
      *             <ul>
 32  
      *               <li><b>"flatten"</b> -
 33  
      *                   The target file name is identical to the
 34  
      * source file name, with all leading
 35  
      *                   directory information stripped off. Both
 36  
      * to and from will be ignored.
 37  
      *               </li>
 38  
      *               <li><b>"glob"</b> -
 39  
      *                   Both to and from define patterns that may
 40  
      * contain at most one *. For each source
 41  
      *                   file that matches the from pattern, a
 42  
      * target file name will be constructed from
 43  
      *                   the to pattern by substituting the * in
 44  
      * the to pattern with the text that matches
 45  
      *                   the * in the from pattern. Source file
 46  
      * names that don't match the from pattern
 47  
      *                   will be ignored.
 48  
      *               </li>
 49  
      *               <li><b>"regexp"</b> -
 50  
      *                   Both to and from define regular
 51  
      * expressions. If the source file name matches the
 52  
      *                   from pattern, the target file name will be
 53  
      * constructed from the to pattern, using
 54  
      *                   \0 to \9 as back-references for the full
 55  
      * match (\0) or the matches of the
 56  
      *                   subexpressions in parentheses. Source
 57  
      * files not matching the from pattern will be
 58  
      *                   ignored.
 59  
      *               </li>
 60  
      *               <li><b>"merge"</b> -
 61  
      *                   The target file name will always be the
 62  
      * same, as defined by to. from will be
 63  
      *                   ignored.
 64  
      *               </li>
 65  
      *               <li><b>"package"</b> -
 66  
      *                   Sharing the same syntax as the glob
 67  
      * mapper, the package mapper replaces directory
 68  
      *                   separators found in the matched source
 69  
      * pattern with dots in the target pattern
 70  
      *                   placeholder.
 71  
      *               </li>
 72  
      *               <li><b>"unpackage"</b> -
 73  
      *                   This mapper is the inverse of the package
 74  
      * mapper. It replaces the dots in a
 75  
      *                   package name with directory separators.
 76  
      * This is useful for matching XML formatter
 77  
      *                   results against their JUnit test test
 78  
      * cases. The mapper shares the sample syntax
 79  
      *                   as the glob mapper.
 80  
      *               </li>
 81  
      *             </ul>
 82  
      *             
 83  
      *           
 84  
      */
 85  10
     private String type = "identity";
 86  
 
 87  
     /**
 88  
      * 
 89  
      *               Specifies a type-specific pattern for matching
 90  
      * source paths which should be mapped.
 91  
      *           
 92  
      */
 93  
     private String from;
 94  
 
 95  
     /**
 96  
      * 
 97  
      *           Specifies a type-specific pattern for producing
 98  
      * paths based on source paths.
 99  
      *           
 100  
      */
 101  
     private String to;
 102  
 
 103  
     /**
 104  
      * 
 105  
      *           Allows specification of a custom mapper
 106  
      * implementation. The class must be of type
 107  
      *          
 108  
      * org.apache.maven.shared.model.fileset.mappers.FileNameMapper,
 109  
      * from the artifact
 110  
      *           org.apache.maven.shared:file-management.
 111  
      *           
 112  
      */
 113  
     private String classname;
 114  
 
 115  
 
 116  
       //-----------/
 117  
      //- Methods -/
 118  
     //-----------/
 119  
 
 120  
     /**
 121  
      * Get 
 122  
      *           Allows specification of a custom mapper
 123  
      * implementation. The class must be of type
 124  
      *          
 125  
      * org.apache.maven.shared.model.fileset.mappers.FileNameMapper,
 126  
      * from the artifact
 127  
      *           org.apache.maven.shared:file-management.
 128  
      *           
 129  
      * 
 130  
      * @return String
 131  
      */
 132  
     public String getClassname()
 133  
     {
 134  0
         return this.classname;
 135  
     } //-- String getClassname() 
 136  
 
 137  
     /**
 138  
      * Get 
 139  
      *               Specifies a type-specific pattern for matching
 140  
      * source paths which should be mapped.
 141  
      *           
 142  
      * 
 143  
      * @return String
 144  
      */
 145  
     public String getFrom()
 146  
     {
 147  0
         return this.from;
 148  
     } //-- String getFrom() 
 149  
 
 150  
     /**
 151  
      * Get 
 152  
      *           Specifies a type-specific pattern for producing
 153  
      * paths based on source paths.
 154  
      *           
 155  
      * 
 156  
      * @return String
 157  
      */
 158  
     public String getTo()
 159  
     {
 160  0
         return this.to;
 161  
     } //-- String getTo() 
 162  
 
 163  
     /**
 164  
      * Get 
 165  
      *             
 166  
      *             Specifies a built-in mapper implementation.
 167  
      *             <br/>
 168  
      *             Valid values:
 169  
      *             <ul>
 170  
      *               <li><b>"flatten"</b> -
 171  
      *                   The target file name is identical to the
 172  
      * source file name, with all leading
 173  
      *                   directory information stripped off. Both
 174  
      * to and from will be ignored.
 175  
      *               </li>
 176  
      *               <li><b>"glob"</b> -
 177  
      *                   Both to and from define patterns that may
 178  
      * contain at most one *. For each source
 179  
      *                   file that matches the from pattern, a
 180  
      * target file name will be constructed from
 181  
      *                   the to pattern by substituting the * in
 182  
      * the to pattern with the text that matches
 183  
      *                   the * in the from pattern. Source file
 184  
      * names that don't match the from pattern
 185  
      *                   will be ignored.
 186  
      *               </li>
 187  
      *               <li><b>"regexp"</b> -
 188  
      *                   Both to and from define regular
 189  
      * expressions. If the source file name matches the
 190  
      *                   from pattern, the target file name will be
 191  
      * constructed from the to pattern, using
 192  
      *                   \0 to \9 as back-references for the full
 193  
      * match (\0) or the matches of the
 194  
      *                   subexpressions in parentheses. Source
 195  
      * files not matching the from pattern will be
 196  
      *                   ignored.
 197  
      *               </li>
 198  
      *               <li><b>"merge"</b> -
 199  
      *                   The target file name will always be the
 200  
      * same, as defined by to. from will be
 201  
      *                   ignored.
 202  
      *               </li>
 203  
      *               <li><b>"package"</b> -
 204  
      *                   Sharing the same syntax as the glob
 205  
      * mapper, the package mapper replaces directory
 206  
      *                   separators found in the matched source
 207  
      * pattern with dots in the target pattern
 208  
      *                   placeholder.
 209  
      *               </li>
 210  
      *               <li><b>"unpackage"</b> -
 211  
      *                   This mapper is the inverse of the package
 212  
      * mapper. It replaces the dots in a
 213  
      *                   package name with directory separators.
 214  
      * This is useful for matching XML formatter
 215  
      *                   results against their JUnit test test
 216  
      * cases. The mapper shares the sample syntax
 217  
      *                   as the glob mapper.
 218  
      *               </li>
 219  
      *             </ul>
 220  
      *             
 221  
      *           
 222  
      * 
 223  
      * @return String
 224  
      */
 225  
     public String getType()
 226  
     {
 227  0
         return this.type;
 228  
     } //-- String getType() 
 229  
 
 230  
     /**
 231  
      * Set 
 232  
      *           Allows specification of a custom mapper
 233  
      * implementation. The class must be of type
 234  
      *          
 235  
      * org.apache.maven.shared.model.fileset.mappers.FileNameMapper,
 236  
      * from the artifact
 237  
      *           org.apache.maven.shared:file-management.
 238  
      *           
 239  
      * 
 240  
      * @param classname
 241  
      */
 242  
     public void setClassname(String classname)
 243  
     {
 244  0
         this.classname = classname;
 245  0
     } //-- void setClassname(String) 
 246  
 
 247  
     /**
 248  
      * Set 
 249  
      *               Specifies a type-specific pattern for matching
 250  
      * source paths which should be mapped.
 251  
      *           
 252  
      * 
 253  
      * @param from
 254  
      */
 255  
     public void setFrom(String from)
 256  
     {
 257  0
         this.from = from;
 258  0
     } //-- void setFrom(String) 
 259  
 
 260  
     /**
 261  
      * Set 
 262  
      *           Specifies a type-specific pattern for producing
 263  
      * paths based on source paths.
 264  
      *           
 265  
      * 
 266  
      * @param to
 267  
      */
 268  
     public void setTo(String to)
 269  
     {
 270  0
         this.to = to;
 271  0
     } //-- void setTo(String) 
 272  
 
 273  
     /**
 274  
      * Set 
 275  
      *             
 276  
      *             Specifies a built-in mapper implementation.
 277  
      *             <br/>
 278  
      *             Valid values:
 279  
      *             <ul>
 280  
      *               <li><b>"flatten"</b> -
 281  
      *                   The target file name is identical to the
 282  
      * source file name, with all leading
 283  
      *                   directory information stripped off. Both
 284  
      * to and from will be ignored.
 285  
      *               </li>
 286  
      *               <li><b>"glob"</b> -
 287  
      *                   Both to and from define patterns that may
 288  
      * contain at most one *. For each source
 289  
      *                   file that matches the from pattern, a
 290  
      * target file name will be constructed from
 291  
      *                   the to pattern by substituting the * in
 292  
      * the to pattern with the text that matches
 293  
      *                   the * in the from pattern. Source file
 294  
      * names that don't match the from pattern
 295  
      *                   will be ignored.
 296  
      *               </li>
 297  
      *               <li><b>"regexp"</b> -
 298  
      *                   Both to and from define regular
 299  
      * expressions. If the source file name matches the
 300  
      *                   from pattern, the target file name will be
 301  
      * constructed from the to pattern, using
 302  
      *                   \0 to \9 as back-references for the full
 303  
      * match (\0) or the matches of the
 304  
      *                   subexpressions in parentheses. Source
 305  
      * files not matching the from pattern will be
 306  
      *                   ignored.
 307  
      *               </li>
 308  
      *               <li><b>"merge"</b> -
 309  
      *                   The target file name will always be the
 310  
      * same, as defined by to. from will be
 311  
      *                   ignored.
 312  
      *               </li>
 313  
      *               <li><b>"package"</b> -
 314  
      *                   Sharing the same syntax as the glob
 315  
      * mapper, the package mapper replaces directory
 316  
      *                   separators found in the matched source
 317  
      * pattern with dots in the target pattern
 318  
      *                   placeholder.
 319  
      *               </li>
 320  
      *               <li><b>"unpackage"</b> -
 321  
      *                   This mapper is the inverse of the package
 322  
      * mapper. It replaces the dots in a
 323  
      *                   package name with directory separators.
 324  
      * This is useful for matching XML formatter
 325  
      *                   results against their JUnit test test
 326  
      * cases. The mapper shares the sample syntax
 327  
      *                   as the glob mapper.
 328  
      *               </li>
 329  
      *             </ul>
 330  
      *             
 331  
      *           
 332  
      * 
 333  
      * @param type
 334  
      */
 335  
     public void setType(String type)
 336  
     {
 337  0
         this.type = type;
 338  0
     } //-- void setType(String) 
 339  
 
 340  
 
 341  10
     private String modelEncoding = "UTF-8";
 342  
 
 343  
     /**
 344  
      * Set an encoding used for reading/writing the model.
 345  
      *
 346  
      * @param modelEncoding the encoding used when reading/writing the model.
 347  
      */
 348  
     public void setModelEncoding( String modelEncoding )
 349  
     {
 350  0
         this.modelEncoding = modelEncoding;
 351  0
     }
 352  
 
 353  
     /**
 354  
      * @return the current encoding used when reading/writing this model.
 355  
      */
 356  
     public String getModelEncoding()
 357  
     {
 358  0
         return modelEncoding;
 359  
     }
 360  
 }