1 19 package org.netbeans.modules.xml.tools.generator; 20 21 import java.util.*; 22 23 29 public class SAXGeneratorModel implements java.io.Serializable { 30 31 32 private static final long serialVersionUID =-3982410888926831459L; 33 34 public static final int JAXP_1_0 = 1; 35 36 public static final int JAXP_1_1 = 2; 37 38 public static final int SAX_1_0 = 1; 39 40 public static final int SAX_2_0 = 2; 41 42 43 private String handler; 44 45 46 private String stub; 47 48 49 private String parslet; 50 51 52 private int SAXversion; 53 54 55 private int JAXPversion; 56 57 58 private String parsletImpl; 59 60 61 private String handlerImpl; 62 63 64 private ElementBindings elementBindings; 65 66 67 private ParsletBindings parsletBindings; 68 69 70 private ElementDeclarations elementDeclarations; 71 72 73 private boolean propagateSAX; 74 75 private String bindings; 76 77 public SAXGeneratorModel() { 78 this(""); } 80 81 public String toString() { 82 StringBuffer sb = new StringBuffer (); 83 sb.append("<SAXGeneratorModel propagateSax=" + propagateSAX + "sax/jaxp=" + SAXversion + "/" + JAXPversion + "\n"); sb.append(elementBindings.toString()); 85 sb.append(" --"); sb.append(parsletBindings.toString()); 87 sb.append("/>\n"); return sb.toString(); 89 } 90 91 92 public SAXGeneratorModel(String prefix) { 93 this(prefix, new ElementDeclarations(null), new ElementBindings(), new ParsletBindings()); 94 } 95 96 public SAXGeneratorModel(String prefix, ElementDeclarations eld, ElementBindings elb, ParsletBindings pab) { 97 handler = prefix + "Handler"; stub = prefix + "Parser"; parslet = prefix + "Parslet"; parsletImpl = prefix + "ParsletImpl"; handlerImpl = prefix + "HandlerImpl"; SAXversion = SAX_1_0; 103 JAXPversion = JAXP_1_1; 104 elementBindings = elb; 105 parsletBindings = pab; 106 elementDeclarations = eld; 107 bindings = prefix + "SAXBindings"; } 109 110 113 public String getHandler() { 114 return handler; 115 } 116 117 120 public void setHandler(String handler) { 121 this.handler = handler; 122 } 123 124 127 public String getStub() { 128 return stub; 129 } 130 131 134 public void setStub(String stub) { 135 this.stub = stub; 136 } 137 138 141 public String getParslet() { 142 return parslet; 143 } 144 145 148 public void setParslet(String parslet) { 149 this.parslet = parslet; 150 } 151 152 155 public int getSAXversion() { 156 return SAXversion; 157 } 158 159 162 public void setSAXversion(int version) { 163 this.SAXversion = version; 164 } 165 166 169 public int getJAXPversion() { 170 return JAXPversion; 171 } 172 173 176 public void setJAXPversion(int JAXPversion) { 177 this.JAXPversion = JAXPversion; 178 } 179 180 183 public String getParsletImpl() { 184 return parsletImpl; 185 } 186 187 190 public void setParsletImpl(String parsletImpl) { 191 this.parsletImpl = parsletImpl; 192 } 193 194 197 public String getHandlerImpl() { 198 return handlerImpl; 199 } 200 201 204 public void setHandlerImpl(String handlerImpl) { 205 this.handlerImpl = handlerImpl; 206 } 207 208 211 public ElementBindings getElementBindings() { 212 return elementBindings; 213 } 214 215 218 public void setElementBindings(ElementBindings elementBindings) { 219 this.elementBindings = elementBindings; 220 } 221 222 225 public ParsletBindings getParsletBindings() { 226 return parsletBindings; 227 } 228 229 232 public void setParsletBindings(ParsletBindings parsletBindings) { 233 this.parsletBindings = parsletBindings; 234 } 235 236 239 public ElementDeclarations getElementDeclarations() { 240 return elementDeclarations; 241 } 242 243 246 public void setElementDeclarations(ElementDeclarations elementDeclarations) { 247 this.elementDeclarations = elementDeclarations; 248 } 249 250 253 public boolean isPropagateSAX() { 254 return propagateSAX; 255 } 256 257 260 public void setPropagateSAX(boolean propagateSAX) { 261 this.propagateSAX = propagateSAX; 262 } 263 264 265 public String getBindings() { 266 return bindings; 267 } 268 269 public void setBindnings(String val) { 270 bindings = val; 271 } 272 273 276 public boolean hasParslets() { 277 return parsletBindings.keySet().isEmpty() == false; 278 } 279 280 283 public void loadElementBindings(ElementBindings bindings) { 284 if (bindings == null) return; 285 286 Iterator it = bindings.values().iterator(); 287 while (it.hasNext()) { 288 ElementBindings.Entry next = (ElementBindings.Entry) it.next(); 289 290 if (elementDeclarations.getEntry(next.getElement()) != null) { 291 elementBindings.put(next.getElement(), next); 292 } 293 } 294 } 295 296 300 public void loadParsletBindings(ParsletBindings parslets) { 301 } 313 } 314 | Popular Tags |