Clover Coverage Report - Checkstyle
Coverage timestamp: Fri May 9 2008 10:48:13 EST
../../../../../img/srcFileCovDistChart8.png 75% of files have more coverage
5   67   4   1.67
2   24   0.8   3
3     1.33  
1    
 
  AbstractOptionCheck       Line # 29 80% 0.8
4.13 5 4 4 0.8
 
  ( 10 of 34)
 
1    ////////////////////////////////////////////////////////////////////////////////
2    // checkstyle: Checks Java source code for adherence to a set of rules.
3    // Copyright (C) 2001-2005 Oliver Burn
4    //
5    // This library is free software; you can redistribute it and/or
6    // modify it under the terms of the GNU Lesser General Public
7    // License as published by the Free Software Foundation; either
8    // version 2.1 of the License, or (at your option) any later version.
9    //
10    // This library is distributed in the hope that it will be useful,
11    // but WITHOUT ANY WARRANTY; without even the implied warranty of
12    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    // Lesser General Public License for more details.
14    //
15    // You should have received a copy of the GNU Lesser General Public
16    // License along with this library; if not, write to the Free Software
17    // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18    ////////////////////////////////////////////////////////////////////////////////
19    package com.puppycrawl.tools.checkstyle.checks;
20   
21    import org.apache.commons.beanutils.ConversionException;
22   
23    import com.puppycrawl.tools.checkstyle.api.Check;
24   
25    /**
26    * Abstract class for checks with options.
27    * @author Rick Giles
28    */
 
29    public abstract class AbstractOptionCheck
30    extends Check
31    {
32    /** the policy to enforce */
33    private AbstractOption mOption;
34   
35    /**
36    * Creates a new <code>AbstractOptionCheck</code> instance.
37    * @param aDefault the default option.
38    */
 
39  34 toggle public AbstractOptionCheck(AbstractOption aDefault)
40    {
41  34 mOption = aDefault;
42    }
43   
44    /**
45    * Set the option to enforce.
46    * @param aOption string to decode option from
47    * @throws ConversionException if unable to decode
48    */
 
49  20 toggle public void setOption(String aOption)
50    throws ConversionException
51    {
52  20 mOption = mOption.decode(aOption);
53  20 if (mOption == null) {
54  0 throw new ConversionException("unable to parse " + aOption);
55    }
56    }
57   
58    /**
59    * @return the <code>AbstractOption</code> set
60    */
 
61  964 toggle public AbstractOption getAbstractOption()
62    {
63    // WARNING!! Do not rename this method to getOption(). It breaks
64    // BeanUtils, which will silently not call setOption. Very annoying!
65  964 return mOption;
66    }
67    }