1 19 package org.enhydra.zeus.binding; 20 21 import org.enhydra.zeus.Binding; 23 import org.enhydra.zeus.InvalidCollectionTypeException; 24 import org.enhydra.zeus.util.ClassUtils; 25 import org.enhydra.zeus.util.NamingUtils; 26 27 43 public abstract class BaseBinding { 44 45 46 protected String xmlName; 47 48 49 protected String xmlNamespaceURI; 50 51 52 protected String xmlType; 53 54 55 protected String xmlTypeNamespaceURI; 56 57 58 protected String xmlParentType; 59 60 61 protected String xmlParentTypeNamespaceURI; 62 63 64 protected boolean isXMLRootElement; 65 66 67 protected String javaName; 68 69 70 protected String javaType; 71 72 73 protected String javaVariableName; 74 75 76 protected String javaInterfacePackage; 77 78 79 protected String javaImplementationPackage; 80 81 82 protected String javaCollectionClass; 83 84 85 protected boolean isJavaSerializable; 86 87 92 public BaseBinding() { 93 isJavaSerializable = true; 94 isXMLRootElement = false; 95 xmlNamespaceURI = ""; 96 xmlTypeNamespaceURI = ""; 97 xmlParentTypeNamespaceURI = ""; 98 } 99 100 109 public String getXMLName() { 110 return xmlName; 111 } 112 119 public void setXMLName(String xmlName) { 120 if (xmlName == null) { 121 throw new IllegalArgumentException ("A Binding cannot have a " + 122 "null XML name."); 123 } 124 125 this.xmlName = xmlName; 126 } 127 128 138 public String getXMLNamespaceURI() { 139 return xmlNamespaceURI; 140 } 141 142 151 public void setXMLNamespaceURI(String xmlNamespaceURI) { 152 if (xmlNamespaceURI == null) { 153 throw new IllegalArgumentException ("A Binding cannot have a " + 154 "null XML namespace URI. To specify no namespace URI, " + 155 "use the empty String (\"\")"); 156 } 157 158 this.xmlNamespaceURI = xmlNamespaceURI; 159 } 160 161 172 public String getXMLType() { 173 return xmlType; 174 } 175 176 184 public void setXMLType(String xmlType) { 185 if (xmlType == null) { 186 throw new IllegalArgumentException ("A Binding cannot have a " + 187 "null XML type."); 188 } 189 190 this.xmlType = xmlType; 191 } 192 193 208 public String getXMLTypeNamespaceURI() { 209 return xmlTypeNamespaceURI; 210 } 211 212 221 public void setXMLTypeNamespaceURI(String xmlTypeNamespaceURI) { 222 if (xmlTypeNamespaceURI == null) { 223 throw new IllegalArgumentException ("A Binding cannot have a " + 224 "null XML type namespace URI. To specify no namespace URI, " + 225 "use the empty String (\"\")"); 226 } 227 228 this.xmlTypeNamespaceURI = xmlTypeNamespaceURI; 229 } 230 231 244 public String getXMLParentType() { 245 return xmlParentType; 246 } 247 248 256 public void setXMLParentType(String xmlParentType) { 257 if (xmlParentType == null) { 258 throw new IllegalArgumentException ("A Binding cannot have a " + 259 "null parent XML type."); 260 } 261 262 this.xmlParentType = xmlParentType; 263 } 264 265 280 public String getXMLParentTypeNamespaceURI() { 281 return xmlParentTypeNamespaceURI; 282 } 283 284 294 public void setXMLParentTypeNamespaceURI(String xmlParentTypeNamespaceURI) { 295 if (xmlParentTypeNamespaceURI == null) { 296 throw new IllegalArgumentException ("A Binding cannot have a " + 297 "null parent XML type namespace URI. To specify no namespace " + 298 "URI, use the empty String (\"\")"); 299 } 300 301 this.xmlParentTypeNamespaceURI = xmlParentTypeNamespaceURI; 302 } 303 304 312 public void setIsXMLRootElement(boolean isXMLRootElement) { 313 this.isXMLRootElement = isXMLRootElement; 314 } 315 316 324 public boolean isXMLRootElement() { 325 return isXMLRootElement; 326 } 327 328 341 public String getJavaName() { 342 return javaName; 343 } 344 345 352 public void setJavaName(String javaName) { 353 if (javaName == null) { 354 throw new IllegalArgumentException ("A Binding cannot have a " + 355 "null Java name."); 356 } 357 358 this.javaName = javaName; 359 } 360 361 372 public String getJavaType() { 373 return javaType; 374 } 375 376 383 public void setJavaType(String javaType) { 384 if (javaType == null) { 385 throw new IllegalArgumentException ("A Binding cannot have a " + 386 "null Java type."); 387 } 388 389 this.javaType = javaType; 390 } 391 392 415 public String getJavaVariableName() { 416 return javaVariableName; 417 } 418 419 428 public void setJavaVariableName(String javaVariableName) { 429 if (javaVariableName == null) { 430 throw new IllegalArgumentException ("A Binding cannot have a " + 431 "null Java variable name."); 432 } 433 434 this.javaVariableName = javaVariableName; 435 } 436 437 446 public String getJavaInterfacePackage() { 447 return javaInterfacePackage; 448 } 449 450 458 public void setJavaInterfacePackage(String javaInterfacePackage) { 459 if (javaInterfacePackage == null) { 460 throw new IllegalArgumentException ("A Binding cannot have a " + 461 "null Java interface package name."); 462 } 463 464 this.javaInterfacePackage = javaInterfacePackage; 465 } 466 467 476 public String getJavaImplementationPackage() { 477 return javaImplementationPackage; 478 } 479 480 488 public void setJavaImplementationPackage(String javaImplementationPackage) { 489 if (javaImplementationPackage == null) { 490 throw new IllegalArgumentException ("A Binding cannot have a " + 491 "null implementation package name."); 492 } 493 494 this.javaImplementationPackage = javaImplementationPackage; 495 } 496 497 508 public void setJavaCollectionClass(String javaCollectionClass) 509 throws InvalidCollectionTypeException { 510 511 if (javaCollectionClass == null) { 512 throw new IllegalArgumentException ("A Binding cannot have a null " + 513 "Java collection class."); 514 } 515 if (!ClassUtils.isCollectionClass(javaCollectionClass)) { 516 throw new InvalidCollectionTypeException(javaCollectionClass); 517 } 518 519 this.javaCollectionClass = javaCollectionClass; 520 } 521 522 531 public String getJavaCollectionClass() { 532 return javaCollectionClass; 533 } 534 535 543 public void setIsJavaSerializable(boolean isJavaSerializable) { 544 this.isJavaSerializable = isJavaSerializable; 545 } 546 547 556 public boolean isJavaSerializable() { 557 return isJavaSerializable; 558 } 559 } 560 | Popular Tags |