javax.xml.bind
Class JAXBContext

java.lang.Object
  extended by javax.xml.bind.JAXBContext

public abstract class JAXBContext
extends Object

The JAXBContext class provides the client's entry point to the JAXB API. It provides an abstraction for managing the XML/Java binding information necessary to implement the JAXB binding framework operations: unmarshal, marshal and validate. A client application obtains new instances of this class via the newInstance(contextPath) method.

Since:
18-Oct-2004
Author:
Thomas.Diesler@jboss.org

Field Summary
static String JAXB_CONTEXT_FACTORY
          The name of the property that contains the name of the class capable of creating new JAXBContext objects.
 
Constructor Summary
JAXBContext()
           
 
Method Summary
abstract  Marshaller createMarshaller()
          Create a Marshaller object that can be used to convert a java content tree into XML data.
abstract  Unmarshaller createUnmarshaller()
          Create an Unmarshaller object that can be used to convert XML data into a java content tree.
abstract  Validator createValidator()
          Create a Validator object that can be used to validate a java content tree against its source schema.
static JAXBContext newInstance(String contextPath)
          Obtain a new instance of a JAXBContext class.
static JAXBContext newInstance(String contextPath, ClassLoader classLoader)
          Obtain a new instance of a JAXBContext class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JAXB_CONTEXT_FACTORY

public static final String JAXB_CONTEXT_FACTORY
The name of the property that contains the name of the class capable of creating new JAXBContext objects.

See Also:
Constant Field Values
Constructor Detail

JAXBContext

public JAXBContext()
Method Detail

createMarshaller

public abstract Marshaller createMarshaller()
                                     throws JAXBException
Create a Marshaller object that can be used to convert a java content tree into XML data.

Throws:
JAXBException

createUnmarshaller

public abstract Unmarshaller createUnmarshaller()
                                         throws JAXBException
Create an Unmarshaller object that can be used to convert XML data into a java content tree.

Throws:
JAXBException

createValidator

public abstract Validator createValidator()
                                   throws JAXBException
Create a Validator object that can be used to validate a java content tree against its source schema.

Throws:
JAXBException

newInstance

public static JAXBContext newInstance(String contextPath)
                               throws JAXBException
Obtain a new instance of a JAXBContext class. This is a convenience method for the newInstance method. It uses the context class loader of the current thread. To specify the use of a different class loader, either set it via the Thread.setContextClassLoader() api or use the newInstance method.

Throws:
JAXBException

newInstance

public static JAXBContext newInstance(String contextPath,
                                      ClassLoader classLoader)
                               throws JAXBException
Obtain a new instance of a JAXBContext class. The client application must supply a context path which is a list of colon (':', :) separated java package names that contain schema derived classes. The JAXB provider will ensure that each package on the context path has a jaxb.properties file which contains a value for the javax.xml.bind.context.factory property and that all values resolve to the same provider. If there are any global XML element name collisions across the various packages listed on the contextPath, a JAXBException will be thrown. Mixing generated classes from multiple JAXB Providers in the same context path will also result in a JAXBException being thrown.

Throws:
JAXBException


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.