background image

ObjectFactory.java Class Code

<< Items.java Class Code | createPurchaseOrder() Method >>
<< Items.java Class Code | createPurchaseOrder() Method >>
24
U
SING
JAXB
java.math.BigInteger getQuantity();
void setQuantity(java.math.BigInteger value);
}
}
ObjectFactory.java
In
ObjectFactory.java
, below:
· The
ObjectFactory
class is part of the
primer.po
package.
·
ObjectFactory
provides factory methods for instantiating Java interfaces
representing XML content in the Java content tree.
· Method names are generated by concatenating:
· The string constant
create
· If the Java content interface is nested within another interface, then the
concatenation of all outer Java class names
· The name of the Java content interface
· JAXB implementation-specific code was removed in this example to
make it easier to read.
For example, in this case, for the Java interface
primer.po.Items.ItemType
,
ObjectFactory
creates the method
createItemsItemType()
.
The
ObjectFactory.java
code looks like this:
package primer.po;
public class ObjectFactory
extends com.sun.xml.bind.DefaultJAXBContextImpl {
/**
* Create a new ObjectFactory that can be used to create
* new instances of schema derived classes for package:
* primer.po
*/
public ObjectFactory() {
super(new primer.po.ObjectFactory.GrammarInfoImpl());
}
/**
* Create an instance of the specified Java content
* interface.
*/
public Object newInstance(Class javaContentInterface)