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.JavaClassAndMethod;
23:
24: public class NonNullSpecification {
25: private final JavaClassAndMethod classAndMethod;
26: private final ParameterNullnessProperty nonNullProperty;
27: private final ParameterNullnessProperty possiblyNullProperty;
28:
29: public NonNullSpecification(JavaClassAndMethod classAndMethod,
30: ParameterNullnessProperty nonParamProperty,
31: ParameterNullnessProperty possiblyNullProperty) {
32: this .classAndMethod = classAndMethod;
33: this .nonNullProperty = nonParamProperty;
34: this .possiblyNullProperty = possiblyNullProperty;
35: }
36:
37: public JavaClassAndMethod getClassAndMethod() {
38: return classAndMethod;
39: }
40:
41: public ParameterNullnessProperty getNonNullProperty() {
42: return nonNullProperty;
43: }
44:
45: public ParameterNullnessProperty getCheckForNullProperty() {
46: return possiblyNullProperty;
47: }
48:
49: @Override
50: public String toString() {
51: StringBuffer buf = new StringBuffer();
52: buf.append(classAndMethod);
53: buf.append(":");
54: if (!nonNullProperty.isEmpty()) {
55: buf.append(" nonull=");
56: buf.append(nonNullProperty);
57: }
58: if (!possiblyNullProperty.isEmpty()) {
59: buf.append(" possiblynull=");
60: buf.append(possiblyNullProperty);
61: }
62: return buf.toString();
63: }
64: }
|