Coverage Report - org.apache.maven.plugin.javadoc.options.Tag
 
Classes in this File Line Coverage Branch Coverage Complexity
Tag
88 %
36/41
25 %
14/56
2,273
 
 1  
 /*
 2  
  * $Id: org.apache.maven.plugin.javadoc.options.Tag.html 829389 2012-08-19 17:23:07Z hboutemy $
 3  
  */
 4  
 
 5  
 package org.apache.maven.plugin.javadoc.options;
 6  
 
 7  
   //---------------------------------/
 8  
  //- Imported classes and packages -/
 9  
 //---------------------------------/
 10  
 
 11  
 import java.util.Date;
 12  
 
 13  
 /**
 14  
  * A Tag parameter.
 15  
  * 
 16  
  * @version $Revision: 829389 $ $Date: 2012-08-19 17:23:07 +0000 (Sun, 19 Aug 2012) $
 17  
  */
 18  11
 public class Tag implements java.io.Serializable {
 19  
 
 20  
 
 21  
       //--------------------------/
 22  
      //- Class/Member Variables -/
 23  
     //--------------------------/
 24  
 
 25  
     /**
 26  
      * Name of the tag.
 27  
      */
 28  
     private String name;
 29  
 
 30  
     /**
 31  
      * Head of the tag.
 32  
      */
 33  
     private String head;
 34  
 
 35  
 
 36  
       //-----------/
 37  
      //- Methods -/
 38  
     //-----------/
 39  
 
 40  
     /**
 41  
      * Method equals.
 42  
      * 
 43  
      * @param other
 44  
      * @return boolean
 45  
      */
 46  
     public boolean equals(Object other)
 47  
     {
 48  2
         if ( this == other)
 49  
         {
 50  0
             return true;
 51  
         }
 52  
         
 53  2
         if ( !(other instanceof Tag) )
 54  
         {
 55  1
             return false;
 56  
         }
 57  
         
 58  1
         Tag that = (Tag) other;
 59  1
         boolean result = true;
 60  
         
 61  1
         result = result && ( getName() == null ? that.getName() == null : getName().equals( that.getName() ) );
 62  1
         result = result && ( getHead() == null ? that.getHead() == null : getHead().equals( that.getHead() ) );
 63  
         
 64  1
         return result;
 65  
     } //-- boolean equals(Object) 
 66  
 
 67  
     /**
 68  
      * Get head of the tag.
 69  
      * 
 70  
      * @return String
 71  
      */
 72  
     public String getHead()
 73  
     {
 74  15
         return this.head;
 75  
     } //-- String getHead() 
 76  
 
 77  
     /**
 78  
      * Get name of the tag.
 79  
      * 
 80  
      * @return String
 81  
      */
 82  
     public String getName()
 83  
     {
 84  17
         return this.name;
 85  
     } //-- String getName() 
 86  
 
 87  
     /**
 88  
      * Method hashCode.
 89  
      * 
 90  
      * @return int
 91  
      */
 92  
     public int hashCode()
 93  
     {
 94  1
         int result = 17;
 95  
         
 96  1
         result = 37 * result + ( name != null ? name.hashCode() : 0 );
 97  1
         result = 37 * result + ( head != null ? head.hashCode() : 0 );
 98  
         
 99  1
         return result;
 100  
     } //-- int hashCode() 
 101  
 
 102  
     /**
 103  
      * Set head of the tag.
 104  
      * 
 105  
      * @param head
 106  
      */
 107  
     public void setHead(String head)
 108  
     {
 109  10
         this.head = head;
 110  10
     } //-- void setHead(String) 
 111  
 
 112  
     /**
 113  
      * Set name of the tag.
 114  
      * 
 115  
      * @param name
 116  
      */
 117  
     public void setName(String name)
 118  
     {
 119  11
         this.name = name;
 120  11
     } //-- void setName(String) 
 121  
 
 122  
     /**
 123  
      * Method toString.
 124  
      * 
 125  
      * @return java.lang.String
 126  
      */
 127  
     public java.lang.String toString()
 128  
     {
 129  2
         StringBuffer buf = new StringBuffer();
 130  
         
 131  2
         buf.append( "name = '" );
 132  2
         buf.append( getName() );
 133  2
         buf.append( "'" );
 134  2
         buf.append( "\n" ); 
 135  2
         buf.append( "head = '" );
 136  2
         buf.append( getHead() );
 137  2
         buf.append( "'" );
 138  
         
 139  2
         return buf.toString();
 140  
     } //-- java.lang.String toString() 
 141  
 
 142  
 
 143  
     /**
 144  
      * Field placement
 145  
      */
 146  
     private String placement;
 147  
 
 148  
     /**
 149  
      * Get the placement.
 150  
      */
 151  
     public String getPlacement()
 152  
     {
 153  11
         return this.placement;
 154  
     }
 155  
 
 156  
     /**
 157  
      * Set a Placement. Should be a combinaison of the letters:
 158  
      * <ul>
 159  
      * <li> X (disable tag)</li>
 160  
      * <li> a (all)</li>
 161  
      * <li> o (overview)</li>
 162  
      * <li> p (packages)</li>
 163  
      * <li> t (types, that is classes and interfaces)</li>
 164  
      * <li> c (constructors)</li>
 165  
      * <li> m (methods)</li>
 166  
      * <li> f (fields)</li>
 167  
      * </ul>
 168  
      *
 169  
      * @param placement
 170  
      * @throws IllegalArgumentException  if not a valid combinaison of the letters
 171  
      */
 172  
     public void setPlacement(String placement)
 173  
       throws IllegalArgumentException
 174  
     {
 175  8
         char[] chars = placement.toCharArray();
 176  22
         for ( int i = 0; i < chars.length; i++ )
 177  
         {
 178  14
             switch ( chars[i] )
 179  
             {
 180  
                 case 'X':
 181  
                 case 'a':
 182  
                 case 'o':
 183  
                 case 'p':
 184  
                 case 't':
 185  
                 case 'c':
 186  
                 case 'm':
 187  
                 case 'f':
 188  14
                     break;
 189  
                 default:
 190  0
                     throw new IllegalArgumentException( "Placement should be a combinaison of the letters 'Xaoptcmf'." );
 191  
             }
 192  
         }
 193  8
         this.placement = placement;
 194  8
     }
 195  
 
 196  
           
 197  11
     private String modelEncoding = "UTF-8";
 198  
 
 199  
     /**
 200  
      * Set an encoding used for reading/writing the model.
 201  
      *
 202  
      * @param modelEncoding the encoding used when reading/writing the model.
 203  
      */
 204  
     public void setModelEncoding( String modelEncoding )
 205  
     {
 206  0
         this.modelEncoding = modelEncoding;
 207  0
     }
 208  
 
 209  
     /**
 210  
      * @return the current encoding used when reading/writing this model.
 211  
      */
 212  
     public String getModelEncoding()
 213  
     {
 214  0
         return modelEncoding;
 215  
     }
 216  
 }