When you run the JAXB binding compiler against the po.xsd XML schema used in the basic examples (Unmarshal Read, Modify Marshal, Unmarshal Validate), the JAXB binding compiler generates a Java package named primer.po containing 11 classes, making a total of 12 classes in each of the basic examples, as described in Table 17–12.
Table 17–12 Schema-Derived JAXB Classes in the Basic Examples
Class |
Description |
---|---|
primer/po/Comment.java |
Public interface extending javax.xml.bind.Element; binds to the global schema element named comment. Note that JAXB generates element interfaces for all global element declarations. |
primer/po/Items.java |
Public interface that binds to the schema complexType named Items. |
primer/po/ObjectFactory.java |
Public class extending com.sun.xml.bind.DefaultJAXBContextImpl; used to create instances of specified interfaces. For example, the ObjectFactory createComment() method instantiates a Comment object. |
primer/po/PurchaseOrder.java |
Public interface extending javax.xml.bind.Element, and PurchaseOrderType; binds to the global schema element named PurchaseOrder. |
primer/po/PurchaseOrderType.java |
Public interface that binds to the schema complexType named PurchaseOrderType. |
primer/po/USAddress.java |
Public interface that binds to the schema complexType named USAddress. |
primer/po/impl/CommentImpl.java |
Implementation of Comment.java |
primer/po/impl/ItemsImpl.java |
Implementation of Items.java |
primer/po/impl/PurchaseOrderImpl.java |
Implementation of PurchaseOrder.java |
primer/po/impl/PurchaseOrderTypeImpl.java |
Implementation of PurchaseOrderType.java |
primer/po/impl/USAddressImpl.java |
Implementation of USAddress.java |
You should never directly use the generated implementation classes (*Impl.java in the packagename/impl/ directory). These classes cannot be referenced directly because the class names in this directory are not standardized by the JAXB specification. The ObjectFactory method is the only portable means to create an instance of a schema-derived interface. There is also an ObjectFactory.newInstance(Class JAXBinterface) method that enables you to create instances of interfaces.
These classes and their specific bindings to the source XML schema for the basic examples are described in Table 17–13. .
Table 17–13 Schema-to-Java Bindings for the Basic Examples