Add local variable information to DB store.
[cfb.git] / prod / net / jaekl / cfb / xml / LocalVariable.java
1 package net.jaekl.cfb.xml;
2
3 import java.io.PrintWriter;
4
5 import org.xml.sax.Attributes;
6
7 import net.jaekl.qd.xml.MissingAttributeException;
8 import net.jaekl.qd.xml.ParseResult;
9 import net.jaekl.qd.xml.XmlParseException;
10
11 public class LocalVariable extends ParseResult {
12
13         static final String TAG = "LocalVariable";
14         static final String[] INTERNAL = { };
15         static final Object[][] EXTERNAL = { };
16
17         static final String NAME = "name";
18         static final String ROLE = "role";
19         
20         String m_name;
21         String m_role;
22         
23         public LocalVariable() {
24                 super(TAG, INTERNAL, EXTERNAL);
25                 
26                 m_name = m_role = null;
27         }
28         
29         public String getName() { return m_name; }
30         public String getRole() { return m_role; }
31         
32         @Override
33         public void handleMainAttributes(Attributes attr)
34                 throws MissingAttributeException
35         {
36                 m_name = getRequiredAttr(TAG, attr, NAME);
37                 m_role = getRequiredAttr(TAG, attr, ROLE);
38         }
39         
40         @Override
41         public void endContents(String uri, String localName, String qName, String chars) 
42                 throws XmlParseException 
43         {
44         }
45
46         @Override
47         public void endExternal(String uri, String localName, String qName)
48                 throws XmlParseException 
49         {
50                 // no-op
51         }
52         
53         @Override
54         public void dump(PrintWriter pw, int indent) 
55         {
56                 super.dump(pw, indent);
57                 String tab = String.format("%" + (indent + 2) + "s", "");
58                 
59                 pw.println(tab + NAME + "=" + m_name);
60                 pw.println(tab + ROLE + "=" + m_role);
61         }
62 }