2e001b23abe93116f71c47782bc1f21b428308e6
[cfb.git] / prod / net / jaekl / cfb / xml / BugMethod.java
1 package net.jaekl.cfb.xml;
2
3 import java.util.ArrayList;
4
5 import org.xml.sax.Attributes;
6
7 import net.jaekl.qd.xml.ParseResult;
8 import net.jaekl.qd.xml.XmlParseException;
9
10 public class BugMethod extends ParseResult {
11         
12         static final String TAG = "Method";
13         static final String[] INTERNAL = { };
14         static final Object[][] EXTERNAL = { { SourceLine.TAG, SourceLine.class} };
15
16         static final String CLASS_NAME = "classname";
17         static final String METHOD_NAME = "name";
18         static final String SIGNATURE = "signature";
19         static final String IS_STATIC = "isStatic";
20         static final String ROLE = "role";
21         
22         static final String TRUE = "true";      // yes value for isStatic
23         
24         String m_className;
25         String m_methodName;
26         String m_signature;
27         boolean m_isStatic;
28         String m_role;          // optional
29         ArrayList<SourceLine> m_sourceLines;
30         
31         public BugMethod() {
32                 super(TAG, INTERNAL, EXTERNAL);
33                 m_className = m_methodName = m_signature = m_role = null;
34                 m_isStatic = false;
35                 m_sourceLines = new ArrayList<SourceLine>();
36         }
37
38         @Override
39         public void endContents(String uri, String localName, String qName, String chars, Attributes attr) 
40                 throws XmlParseException 
41         {
42                 m_className = getRequiredAttr(TAG, attr, CLASS_NAME);
43                 m_methodName = getRequiredAttr(TAG, attr, METHOD_NAME);
44                 m_signature = getRequiredAttr(TAG, attr, SIGNATURE);
45                 m_isStatic = getRequiredAttr(TAG, attr, IS_STATIC).equals(TRUE);
46                 m_role = getOptionalAttr(attr, ROLE, null);
47         }
48
49         @Override
50         public void endExternal(String uri, String localName, String qName)
51                 throws XmlParseException 
52         {
53                 if (SourceLine.TAG.equals(localName)) {
54                         ParseResult[] collected = collectParsedChildren(SourceLine.class);
55                         for (ParseResult pr : collected) {
56                                 assert(pr instanceof SourceLine);
57                                 m_sourceLines.add((SourceLine)pr);
58                         }
59                 }
60         }
61
62 }