01: /*
02: * Bytecode Analysis Framework
03: * Copyright (C) 2005, University of Maryland
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
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
32: MethodPropertyDatabase<ParameterNullnessProperty> {
33:
34: /* (non-Javadoc)
35: * @see edu.umd.cs.findbugs.ba.interproc.MethodPropertyDatabase#decodeProperty(java.lang.String)
36: */
37:
38: @Override
39: protected ParameterNullnessProperty decodeProperty(String propStr)
40: throws PropertyDatabaseFormatException {
41: try {
42: int unconditionalDerefSet = Integer.parseInt(propStr);
43: ParameterNullnessProperty prop = new ParameterNullnessProperty();
44: prop.setNonNullParamSet(unconditionalDerefSet);
45: return prop;
46: } catch (NumberFormatException e) {
47: throw new PropertyDatabaseFormatException(
48: "Invalid unconditional deref param set: " + propStr);
49: }
50: }
51:
52: /* (non-Javadoc)
53: * @see edu.umd.cs.findbugs.ba.interproc.MethodPropertyDatabase#encodeProperty(Property)
54: */
55:
56: @Override
57: protected String encodeProperty(ParameterNullnessProperty property) {
58: return String.valueOf(property.getNonNullParamSet());
59: }
60:
61: }
|