01: /*
02: * Created on Sep 22, 2004
03: */
04: package uk.org.ponder.saxalizer.mapping;
05:
06: import uk.org.ponder.saxalizer.DeSAXalizable;
07: import uk.org.ponder.saxalizer.SAMSList;
08: import uk.org.ponder.saxalizer.SAXAccessMethodSpec;
09: import uk.org.ponder.saxalizer.SAXalizable;
10: import uk.org.ponder.saxalizer.SAXalizableAttrs;
11:
12: /**
13: * @author Antranig Basman (antranig@caret.cam.ac.uk)
14: *
15: */
16: public class SAXalizerMapperEntry implements SAXalizable,
17: DeSAXalizable, SAXalizableAttrs {
18: public Class targetclass;
19: public boolean defaultible = false;
20: private SAMSList subtagentries = new SAMSList();
21:
22: public SAXAccessMethodSpec[] getSAXSetMethods() {
23: return new SAXAccessMethodSpec[] {
24: new SAXAccessMethodSpec("taghandler", "addTagHandler",
25: SAXAccessMethodSpec.class),
26: new SAXAccessMethodSpec("defaultible", "defaultible",
27: Boolean.TYPE, SAXAccessMethodSpec.ACCESS_FIELD) };
28: }
29:
30: public SAXAccessMethodSpec[] getSAXSetAttrMethods() {
31: return new SAXAccessMethodSpec[] { new SAXAccessMethodSpec(
32: "targetclass", "targetclass", Class.class,
33: SAXAccessMethodSpec.ACCESS_FIELD) };
34: }
35:
36: public SAXAccessMethodSpec[] getSAXGetMethods() {
37: // TODO Auto-generated method stub
38: return null;
39: }
40:
41: public void addTagHandler(SAXAccessMethodSpec toadd) {
42: subtagentries.add(toadd);
43: }
44:
45: public int size() {
46: return subtagentries.size();
47: }
48:
49: public SAXAccessMethodSpec specAt(int i) {
50: return (SAXAccessMethodSpec) subtagentries.get(i);
51: }
52:
53: public void remove(int index) {
54: subtagentries.remove(index);
55: }
56:
57: public void addNonDuplicate(SAXAccessMethodSpec newspec) {
58: for (int i = 0; i < size(); ++i) {
59: SAXAccessMethodSpec this spec = specAt(i);
60: if (this spec.isDuplicate(newspec)) {
61: return;
62: }
63: }
64: addTagHandler(newspec);
65: }
66:
67: public SAMSList getSAMSList() {
68: return subtagentries;
69: }
70:
71: }
|