Package org.apache.axis2.datasource.jaxb
Class JAXBDSContext
java.lang.Object
org.apache.axis2.datasource.jaxb.JAXBDSContext
- Direct Known Subclasses:
JAXBBlockContext
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJAXBDSContext(jakarta.xml.bind.JAXBContext jaxbContext) "Dispatch" Constructor Use this full constructor when the JAXBContent is provided by the customer.JAXBDSContext(String contextPackage) Deprecated.JAXBDSContext(TreeSet<String> packages) Slightly slower constructorJAXBDSContext(TreeSet<String> packages, String packagesKey) Full Constructor JAXBDSContext (most performant) -
Method Summary
Modifier and TypeMethodDescriptionprotected AttachmentContextjakarta.xml.bind.JAXBContextjakarta.xml.bind.JAXBContextjakarta.xml.bind.JAXBContextgetJAXBContext(ClassLoader cl, boolean forceArrays) org.apache.axis2.context.MessageContextClass<?>booleanvoidmarshal(Object obj, XMLStreamWriter writer) Marshal the jaxb objectvoidsetIsxmlList(boolean isxmlList) voidsetMessageContext(org.apache.axis2.context.MessageContext messageContext) voidsetProcessType(Class<?> type) The procesess type to indicate the class of the target of the unmarshaling.voidsetWebServiceNamespace(String namespace) unmarshal(org.apache.axiom.om.OMElement element) Unmarshal the xml into a JAXB objectstatic ObjectunmarshalAsListOrArray(XMLStreamReader reader, jakarta.xml.bind.Unmarshaller u, Class<?> type) convert the String into a list or arraystatic ObjectunmarshalByElement(jakarta.xml.bind.Unmarshaller u, XMLStreamReader reader) Preferred way to unmarshal objectsstatic ObjectunmarshalByType(jakarta.xml.bind.Unmarshaller u, XMLStreamReader reader, Class<?> type, boolean isList, JAXBUtils.CONSTRUCTION_TYPE ctype) The root element being read is defined by schema/JAXB; however its contents are known by schema/JAXB.
-
Field Details
-
DEBUG_ENABLED
public static final boolean DEBUG_ENABLED
-
-
Constructor Details
-
JAXBDSContext
Full Constructor JAXBDSContext (most performant)- Parameters:
packages- Set of packages needed by the JAXBContext.
-
JAXBDSContext
Slightly slower constructor- Parameters:
packages-
-
JAXBDSContext
Deprecated.Normal Constructor JAXBBlockContext- Parameters:
contextPackage-
-
JAXBDSContext
public JAXBDSContext(jakarta.xml.bind.JAXBContext jaxbContext) "Dispatch" Constructor Use this full constructor when the JAXBContent is provided by the customer.- Parameters:
jaxbContext-
-
-
Method Details
-
getContextPackages
- Returns:
- Class representing type of the element
-
getJAXBContext
public jakarta.xml.bind.JAXBContext getJAXBContext() throws jakarta.xml.bind.JAXBException- Throws:
jakarta.xml.bind.JAXBException
-
getJAXBContext
public jakarta.xml.bind.JAXBContext getJAXBContext(ClassLoader cl) throws jakarta.xml.bind.JAXBException - Returns:
- get the JAXBContext
- Throws:
jakarta.xml.bind.JAXBException
-
getJAXBContext
public jakarta.xml.bind.JAXBContext getJAXBContext(ClassLoader cl, boolean forceArrays) throws jakarta.xml.bind.JAXBException - Parameters:
ClassLoader-forceArrays- boolean (if true, then JAXBContext will automatically contain arrays)- Returns:
- get the JAXBContext
- Throws:
jakarta.xml.bind.JAXBException
-
setWebServiceNamespace
-
getProcessType
- Returns:
- RPC Declared Type
-
setProcessType
The procesess type to indicate the class of the target of the unmarshaling. This method should only be used in the cases where the element being unmarshaled is not known to the JAXBContext (examples include RPC/Literal processing and Doc/Literal Wrapped processing with a non-element wrapper class)- Parameters:
type-
-
getConstructionType
-
isxmlList
public boolean isxmlList() -
setIsxmlList
public void setIsxmlList(boolean isxmlList) -
getMessageContext
public org.apache.axis2.context.MessageContext getMessageContext() -
setMessageContext
public void setMessageContext(org.apache.axis2.context.MessageContext messageContext) -
getClassLoader
-
createAttachmentContext
-
unmarshal
public Object unmarshal(org.apache.axiom.om.OMElement element) throws jakarta.xml.bind.JAXBException Unmarshal the xml into a JAXB object- Parameters:
element-- Returns:
- Throws:
jakarta.xml.bind.JAXBException
-
marshal
Marshal the jaxb object- Parameters:
obj-writer-am- AttachmentMarshaller, optional Attachment- Throws:
jakarta.xml.bind.JAXBException
-
unmarshalByType
public static Object unmarshalByType(jakarta.xml.bind.Unmarshaller u, XMLStreamReader reader, Class<?> type, boolean isList, JAXBUtils.CONSTRUCTION_TYPE ctype) throws jakarta.xml.ws.WebServiceException The root element being read is defined by schema/JAXB; however its contents are known by schema/JAXB. Therefore we use unmarshal by the declared type (This method is used to unmarshal rpc elements)- Parameters:
u- Unmarshallerreader- XMLStreamReadertype- Class- Returns:
- Object
- Throws:
jakarta.xml.ws.WebServiceException
-
unmarshalAsListOrArray
public static Object unmarshalAsListOrArray(XMLStreamReader reader, jakarta.xml.bind.Unmarshaller u, Class<?> type) throws IllegalAccessException, ParseException, NoSuchMethodException, InstantiationException, DatatypeConfigurationException, InvocationTargetException, jakarta.xml.bind.JAXBException convert the String into a list or array- Type Parameters:
T-- Parameters:
jaxb-type-- Returns:
- Throws:
IllegalAccessExceptionParseExceptionNoSuchMethodExceptionInstantiationExceptionDatatypeConfigurationExceptionInvocationTargetExceptionjakarta.xml.bind.JAXBException
-
unmarshalByElement
public static Object unmarshalByElement(jakarta.xml.bind.Unmarshaller u, XMLStreamReader reader) throws jakarta.xml.ws.WebServiceException Preferred way to unmarshal objects- Parameters:
u- Unmarshallerreader- XMLStreamReader- Returns:
- Object that represents an element
- Throws:
jakarta.xml.ws.WebServiceException
-