|
|||||||||
| Home >> All >> javax >> xml >> [ bind overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
javax.xml.bind
Class JAXBContext

java.lang.Objectjavax.xml.bind.JAXBContext
- public abstract class JAXBContext
- extends java.lang.Object
The JAXBContext provides the JAXB users anchor to
the implmentation and hos generated classes. A JAXBContext is used to
obtain instances of Marshaller,
Unmarshaller, and
Validator. To obtain a JAXBContext, the
application invokes
JAXBContext context = JAXBContext.newInstance("com.mycompany:com.mycompany.xml");
The list of colon separated package names matches the list in the
schemas used to generate classes. In other words: If you have a
schema using package name "com.mycompany.xml", then this package
name has to be part of the list.
The JAXBContext class will scan the given list of packages
for a file called jaxb.properties. This file contains the
name of an instantiation class in the property
JAXB_CONTEXT_FACTORY 55 . (See newInstance(String) 55 for
details on how the class name is obtained.) Once such a file is found, the
given class is loaded via ClassLoader.loadClass(java.lang.String)>ClassLoader.loadClass(java.lang.String) 55 .
The JAXBContext class demands, that the created object
has a method
public static JAXBContext createContext(String pPath, ClassLoader pClassLoader)
throws JAXBException;
This method is invoked with the same path and java.lang.ClassLoader than
above. See newInstance(String,ClassLoader) 55 } for details on the choice
of the java.lang.ClassLoader.
The created context will scan the same package path for implementation
specific configuration details (in the case of the JaxMe
application a file called Configuration.xml in any of the
packages) and do whatever else is required to initialize the runtime.
In particular it will invoke
DatatypeConverter.setDatatypeConverter(DatatypeConverterInterface) 55 .
- Since:
- JAXB1.0
| Field Summary | |
private static java.lang.Class[] |
CONTEXT_CLASSES
|
static java.lang.String |
JAXB_CONTEXT_FACTORY
This is the name of the property used to determine the name of the initialization class: "javax.xml.bind.context.factory". |
| Constructor Summary | |
JAXBContext()
|
|
| Method Summary | |
abstract Marshaller |
createMarshaller()
Creates a new instance of Marshaller. |
abstract Unmarshaller |
createUnmarshaller()
Creates a new instance of Unmarshaller. |
abstract Validator |
createValidator()
Creates a new instance of Validator. |
static JAXBContext |
newInstance(java.lang.String pPath)
Creates a new instance of JAXBContext by applying
the following algorithm:
The first step is to determine the name of an initialization class. |
static JAXBContext |
newInstance(java.lang.String pPath,
java.lang.ClassLoader pClassLoader)
Creates a new instance of JAXBContext by applying
the following algorithm:
The first step is to determine the name of an initialization class. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
CONTEXT_CLASSES
private static final java.lang.Class[] CONTEXT_CLASSES
JAXB_CONTEXT_FACTORY
public static final java.lang.String JAXB_CONTEXT_FACTORY
This is the name of the property used to determine the name of the initialization class: "javax.xml.bind.context.factory". The name is used by
newInstance(String)55 andnewInstance(String,ClassLoader)55 . It contains a class name. The class must contain a static methodpublic static JAXBContext createContext(String, ClassLoader) throws JAXBException;
which is invoked to create the actual instance of JAXBContext.- See Also:
- Constant Field Values
| Constructor Detail |
JAXBContext
public JAXBContext()
| Method Detail |
newInstance
public static JAXBContext newInstance(java.lang.String pPath) throws JAXBException
Creates a new instance of
JAXBContextby applying the following algorithm:- The first step is to determine the name of an initialization class.
For any of the package names in the list given by
pPaththeJAXBContextclass will try to find a file called jaxb.properties. This file's got to be in standard property file format. TheJAXBContextclass will load the property file. - A property called "javax.xml.bind.context.factory" (see
JAXB_CONTEXT_FACTORY55 ) is evaluated. It must contain the name of an initialization class. The initialization class is loaded viaThread.currentThread().getContextClassLoader().loadClass(String). - The initialization class must contain a method
public static JAXBContext createContext(String, ClassLoader) throws JAXBException;which is invoked with thepPathargument and the java.lang.ClassLoader of theJAXBContext class as parameters. The result of this method is also used as the result of thenewInstance(String)method.
- The first step is to determine the name of an initialization class.
For any of the package names in the list given by
newInstance
public static JAXBContext newInstance(java.lang.String pPath, java.lang.ClassLoader pClassLoader) throws JAXBException
Creates a new instance of
JAXBContextby applying the following algorithm:- The first step is to determine the name of an initialization class.
For any of the package names in the list given by
pPaththeJAXBContextclass will try to find a file called jaxb.properties. This file's got to be in standard property file format. TheJAXBContextclass will load the property file. - A property called "javax.xml.bind.context.factory" (see
JAXB_CONTEXT_FACTORY55 ) is evaluated. It must contain the name of an initialization class. The initialization class is loaded viapClassLoader.loadClass(String). - The initialization class must contain a method
public static JAXBContext createContext(String, ClassLoader) throws JAXBException;which is invoked with the parameterspPathandpClassLoader. The result of this method is also used as the result of thenewInstance(String)method.
- The first step is to determine the name of an initialization class.
For any of the package names in the list given by
createMarshaller
public abstract Marshaller createMarshaller() throws JAXBException
Creates a new instance of Marshaller. The Marshaller can be used to convert JAXB objects into XML data.
Note: Marshallers are reusable, but not reentrant (thread safe).
createUnmarshaller
public abstract Unmarshaller createUnmarshaller() throws JAXBException
Creates a new instance of Unmarshaller. The Unmarshaller can be used to convert XML data into JAXB objects.
Note: Unmarshallers are reusable, but not reentrant (thread safe).
createValidator
public abstract Validator createValidator() throws JAXBException
|
|||||||||
| Home >> All >> javax >> xml >> [ bind overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
javax.xml.bind.JAXBContext