KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > vladium > emma > data > CoverageOptionsFactory


1 /* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved.
2  *
3  * This program and the accompanying materials are made available under
4  * the terms of the Common Public License v1.0 which accompanies this distribution,
5  * and is available at http://www.eclipse.org/legal/cpl-v10.html
6  *
7  * $Id: CoverageOptionsFactory.java,v 1.1.2.1 2004/06/27 22:58:26 vlad_r Exp $
8  */

9 package com.vladium.emma.data;
10
11 import java.util.Properties JavaDoc;
12
13 import com.vladium.emma.instr.InstrProcessor;
14 import com.vladium.util.IProperties;
15 import com.vladium.util.Property;
16
17 // ----------------------------------------------------------------------------
18
/**
19  * @author Vlad Roubtsov, (C) 2004
20  */

21 public
22 abstract class CoverageOptionsFactory
23 {
24     // public: ................................................................
25

26     public static CoverageOptions create (final Properties JavaDoc properties)
27     {
28         final boolean excludeSyntheticMethods =
29             Property.toBoolean (properties.getProperty (InstrProcessor.PROPERTY_EXCLUDE_SYNTHETIC_METHODS,
30                                                         InstrProcessor.DEFAULT_EXCLUDE_SYNTHETIC_METHODS));
31                                                                         
32         final boolean excludeBridgeMethods =
33             Property.toBoolean (properties.getProperty (InstrProcessor.PROPERTY_EXCLUDE_BRIDGE_METHODS,
34                                                         InstrProcessor.DEFAULT_EXCLUDE_BRIDGE_METHODS));
35                                                                                             
36         final boolean doSUIDCompensaton =
37             Property.toBoolean (properties.getProperty (InstrProcessor.PROPERTY_DO_SUID_COMPENSATION,
38                                                         InstrProcessor.DEFAULT_DO_SUID_COMPENSATION));
39         
40         return new CoverageOptions (excludeSyntheticMethods, excludeBridgeMethods, doSUIDCompensaton);
41     }
42     
43     public static CoverageOptions create (final IProperties properties)
44     {
45         final boolean excludeSyntheticMethods =
46             Property.toBoolean (properties.getProperty (InstrProcessor.PROPERTY_EXCLUDE_SYNTHETIC_METHODS,
47                                                         InstrProcessor.DEFAULT_EXCLUDE_SYNTHETIC_METHODS));
48         
49         final boolean excludeBridgeMethods =
50             Property.toBoolean (properties.getProperty (InstrProcessor.PROPERTY_EXCLUDE_BRIDGE_METHODS,
51                                                         InstrProcessor.DEFAULT_EXCLUDE_BRIDGE_METHODS));
52                                                                                          
53         final boolean doSUIDCompensaton =
54             Property.toBoolean (properties.getProperty (InstrProcessor.PROPERTY_DO_SUID_COMPENSATION,
55                                                         InstrProcessor.DEFAULT_DO_SUID_COMPENSATION));
56         
57         return new CoverageOptions (excludeSyntheticMethods, excludeBridgeMethods, doSUIDCompensaton);
58     }
59     
60     // protected: .............................................................
61

62     // package: ...............................................................
63

64     // private: ...............................................................
65

66
67     private CoverageOptionsFactory () {} // this class is not extendible
68

69 } // end of class
70
// ----------------------------------------------------------------------------
Popular Tags