KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > umd > cs > findbugs > ba > npe > ParameterNullnessPropertyDatabase


1 /*
2  * Bytecode Analysis Framework
3  * Copyright (C) 2005, University of Maryland
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
20 package edu.umd.cs.findbugs.ba.npe;
21
22 import edu.umd.cs.findbugs.ba.interproc.MethodPropertyDatabase;
23 import edu.umd.cs.findbugs.ba.interproc.PropertyDatabaseFormatException;
24
25 /**
26  * Method property database storing which method parameters might
27  * be unconditionally dereferenced.
28  *
29  * @author David Hovemeyer
30  */

31 public class ParameterNullnessPropertyDatabase extends MethodPropertyDatabase<ParameterNullnessProperty> {
32     
33     /* (non-Javadoc)
34      * @see edu.umd.cs.findbugs.ba.interproc.MethodPropertyDatabase#decodeProperty(java.lang.String)
35      */

36     //@Override
37
@Override JavaDoc
38          protected ParameterNullnessProperty decodeProperty(String JavaDoc propStr)
39             throws PropertyDatabaseFormatException {
40         try {
41             int unconditionalDerefSet = Integer.parseInt(propStr);
42             ParameterNullnessProperty prop = new ParameterNullnessProperty();
43             prop.setNonNullParamSet(unconditionalDerefSet);
44             return prop;
45         } catch (NumberFormatException JavaDoc e) {
46             throw new PropertyDatabaseFormatException("Invalid unconditional deref param set: " + propStr);
47         }
48     }
49
50     /* (non-Javadoc)
51      * @see edu.umd.cs.findbugs.ba.interproc.MethodPropertyDatabase#encodeProperty(Property)
52      */

53     //@Override
54
@Override JavaDoc
55          protected String JavaDoc encodeProperty(ParameterNullnessProperty property) {
56         return String.valueOf(property.getNonNullParamSet());
57     }
58
59 }
60
Popular Tags