KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > umd > cs > findbugs > ba > type > FieldStoreTypeDatabase


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.type;
21
22 import java.util.Iterator JavaDoc;
23 import java.util.StringTokenizer JavaDoc;
24
25 import edu.umd.cs.findbugs.ba.interproc.FieldPropertyDatabase;
26 import edu.umd.cs.findbugs.ba.interproc.PropertyDatabaseFormatException;
27
28 /**
29  * @author David Hovemeyer
30  */

31 public class FieldStoreTypeDatabase
32     extends FieldPropertyDatabase<FieldStoreType> {
33     
34     public static final String JavaDoc DEFAULT_FILENAME = "fieldStoreTypes.db";
35
36     //@Override
37
@Override JavaDoc
38          protected FieldStoreType decodeProperty(String JavaDoc propStr) throws PropertyDatabaseFormatException {
39         FieldStoreType property = new FieldStoreType();
40         StringTokenizer JavaDoc t = new StringTokenizer JavaDoc(propStr, ",");
41         while (t.hasMoreTokens()) {
42             String JavaDoc signature = t.nextToken();
43             property.addTypeSignature(signature);
44         }
45         return property;
46     }
47
48     //@Override
49
@Override JavaDoc
50          protected String JavaDoc encodeProperty(FieldStoreType property) {
51         StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
52         for (Iterator JavaDoc<String JavaDoc> i = property.signatureIterator(); i.hasNext();) {
53             if (buf.length() > 0) {
54                 buf.append(',');
55             }
56             buf.append(i.next());
57         }
58         return buf.toString();
59     }
60
61 }
62
Popular Tags