Added @Override
This commit is contained in:
parent
03582973d7
commit
6ba9ad8116
|
|
@ -264,10 +264,12 @@ public class CastorMarshaller extends AbstractMarshaller implements Initializing
|
|||
// Marshalling
|
||||
//
|
||||
|
||||
@Override
|
||||
protected final void marshalDomNode(Object graph, Node node) throws XmlMappingException {
|
||||
marshalSaxHandlers(graph, new DomContentHandler(node), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void marshalSaxHandlers(Object graph, ContentHandler contentHandler, LexicalHandler lexicalHandler)
|
||||
throws XmlMappingException {
|
||||
Marshaller marshaller = xmlContext.createMarshaller();
|
||||
|
|
@ -275,21 +277,25 @@ public class CastorMarshaller extends AbstractMarshaller implements Initializing
|
|||
marshal(graph, marshaller);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void marshalOutputStream(Object graph, OutputStream outputStream)
|
||||
throws XmlMappingException, IOException {
|
||||
marshalWriter(graph, new OutputStreamWriter(outputStream, encoding));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void marshalWriter(Object graph, Writer writer) throws XmlMappingException, IOException {
|
||||
Marshaller marshaller = xmlContext.createMarshaller();
|
||||
marshaller.setWriter(writer);
|
||||
marshal(graph, marshaller);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void marshalXmlEventWriter(Object graph, XMLEventWriter eventWriter) throws XmlMappingException {
|
||||
marshalSaxHandlers(graph, new StaxEventContentHandler(eventWriter), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void marshalXmlStreamWriter(Object graph, XMLStreamWriter streamWriter) throws XmlMappingException {
|
||||
marshalSaxHandlers(graph, new StaxStreamContentHandler(streamWriter), null);
|
||||
}
|
||||
|
|
@ -327,6 +333,7 @@ public class CastorMarshaller extends AbstractMarshaller implements Initializing
|
|||
// Unmarshalling
|
||||
//
|
||||
|
||||
@Override
|
||||
protected final Object unmarshalDomNode(Node node) throws XmlMappingException {
|
||||
try {
|
||||
return createUnmarshaller().unmarshal(node);
|
||||
|
|
@ -336,6 +343,7 @@ public class CastorMarshaller extends AbstractMarshaller implements Initializing
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final Object unmarshalInputStream(InputStream inputStream) throws XmlMappingException, IOException {
|
||||
try {
|
||||
return createUnmarshaller().unmarshal(new InputSource(inputStream));
|
||||
|
|
@ -345,6 +353,7 @@ public class CastorMarshaller extends AbstractMarshaller implements Initializing
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final Object unmarshalReader(Reader reader) throws XmlMappingException, IOException {
|
||||
try {
|
||||
return createUnmarshaller().unmarshal(new InputSource(reader));
|
||||
|
|
@ -354,6 +363,7 @@ public class CastorMarshaller extends AbstractMarshaller implements Initializing
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final Object unmarshalXmlEventReader(XMLEventReader eventReader) {
|
||||
XMLReader reader = new StaxEventXmlReader(eventReader);
|
||||
try {
|
||||
|
|
@ -364,6 +374,7 @@ public class CastorMarshaller extends AbstractMarshaller implements Initializing
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final Object unmarshalSaxReader(XMLReader xmlReader, InputSource inputSource)
|
||||
throws XmlMappingException, IOException {
|
||||
UnmarshalHandler unmarshalHandler = createUnmarshaller().createHandler();
|
||||
|
|
@ -378,6 +389,7 @@ public class CastorMarshaller extends AbstractMarshaller implements Initializing
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final Object unmarshalXmlStreamReader(XMLStreamReader streamReader) {
|
||||
XMLReader reader = new StaxStreamXmlReader(streamReader);
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ class Jaxb1MarshallerBeanDefinitionParser extends AbstractSimpleBeanDefinitionPa
|
|||
|
||||
public static final String JAXB1_MARSHALLER_CLASS_NAME = "org.springframework.oxm.jaxb.Jaxb1Marshaller";
|
||||
|
||||
@Override
|
||||
protected String getBeanClassName(Element element) {
|
||||
return JAXB1_MARSHALLER_CLASS_NAME;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,10 +37,12 @@ class Jaxb2MarshallerBeanDefinitionParser extends AbstractSingleBeanDefinitionPa
|
|||
|
||||
private static final String JAXB2_MARSHALLER_CLASS_NAME = "org.springframework.oxm.jaxb.Jaxb2Marshaller";
|
||||
|
||||
@Override
|
||||
protected String getBeanClassName(Element element) {
|
||||
return JAXB2_MARSHALLER_CLASS_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder beanDefinitionBuilder) {
|
||||
String contextPath = element.getAttribute("contextPath");
|
||||
if (StringUtils.hasText(contextPath)) {
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ class JibxMarshallerBeanDefinitionParser extends AbstractSimpleBeanDefinitionPar
|
|||
|
||||
private static final String JIBX_MARSHALLER_CLASS_NAME = "org.springframework.oxm.jibx.JibxMarshaller";
|
||||
|
||||
@Override
|
||||
protected String getBeanClassName(Element element) {
|
||||
return JIBX_MARSHALLER_CLASS_NAME;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,10 +33,12 @@ class XmlBeansMarshallerBeanDefinitionParser extends AbstractSingleBeanDefinitio
|
|||
|
||||
public static final String XML_BEANS_MARSHALLER_CLASS_NAME = "org.springframework.oxm.xmlbeans.XmlBeansMarshaller";
|
||||
|
||||
@Override
|
||||
protected String getBeanClassName(Element element) {
|
||||
return XML_BEANS_MARSHALLER_CLASS_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder beanDefinitionBuilder) {
|
||||
String optionsName = element.getAttribute("options");
|
||||
if (StringUtils.hasText(optionsName)) {
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ public class Jaxb1Marshaller extends AbstractJaxbMarshaller implements BeanClass
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final JAXBContext createJaxbContext() throws JAXBException {
|
||||
if (!StringUtils.hasLength(getContextPath())) {
|
||||
throw new IllegalArgumentException("contextPath is required");
|
||||
|
|
@ -95,6 +96,7 @@ public class Jaxb1Marshaller extends AbstractJaxbMarshaller implements BeanClass
|
|||
JAXBContext.newInstance(getContextPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initJaxbUnmarshaller(Unmarshaller unmarshaller) throws JAXBException {
|
||||
unmarshaller.setValidating(validating);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -267,6 +267,7 @@ public class Jaxb2Marshaller extends AbstractJaxbMarshaller
|
|||
* JAXBContext
|
||||
*/
|
||||
|
||||
@Override
|
||||
protected JAXBContext createJaxbContext() throws Exception {
|
||||
if (JaxbUtils.getJaxbVersion() < JaxbUtils.JAXB_2) {
|
||||
throw new IllegalStateException(
|
||||
|
|
@ -330,6 +331,7 @@ public class Jaxb2Marshaller extends AbstractJaxbMarshaller
|
|||
* Marshaller/Unmarshaller
|
||||
*/
|
||||
|
||||
@Override
|
||||
protected void initJaxbMarshaller(Marshaller marshaller) throws JAXBException {
|
||||
if (schema != null) {
|
||||
marshaller.setSchema(schema);
|
||||
|
|
@ -344,6 +346,7 @@ public class Jaxb2Marshaller extends AbstractJaxbMarshaller
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initJaxbUnmarshaller(Unmarshaller unmarshaller) throws JAXBException {
|
||||
if (schema != null) {
|
||||
unmarshaller.setSchema(schema);
|
||||
|
|
@ -454,6 +457,7 @@ public class Jaxb2Marshaller extends AbstractJaxbMarshaller
|
|||
this.mimeContainer = mimeContainer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String addMtomAttachment(byte[] data,
|
||||
int offset,
|
||||
int length,
|
||||
|
|
@ -464,6 +468,7 @@ public class Jaxb2Marshaller extends AbstractJaxbMarshaller
|
|||
return addMtomAttachment(new DataHandler(dataSource), elementNamespace, elementLocalName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String addMtomAttachment(DataHandler dataHandler, String elementNamespace, String elementLocalName) {
|
||||
String host = getHost(elementNamespace, dataHandler);
|
||||
String contentId = UUID.randomUUID() + "@" + host;
|
||||
|
|
@ -488,6 +493,7 @@ public class Jaxb2Marshaller extends AbstractJaxbMarshaller
|
|||
return dataHandler.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String addSwaRefAttachment(DataHandler dataHandler) {
|
||||
String contentId = UUID.randomUUID() + "@" + dataHandler.getName();
|
||||
mimeContainer.addAttachment(contentId, dataHandler);
|
||||
|
|
@ -508,6 +514,7 @@ public class Jaxb2Marshaller extends AbstractJaxbMarshaller
|
|||
this.mimeContainer = mimeContainer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getAttachmentAsByteArray(String cid) {
|
||||
try {
|
||||
DataHandler dataHandler = getAttachmentAsDataHandler(cid);
|
||||
|
|
@ -518,6 +525,7 @@ public class Jaxb2Marshaller extends AbstractJaxbMarshaller
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataHandler getAttachmentAsDataHandler(String contentId) {
|
||||
if (contentId.startsWith("cid:")) {
|
||||
contentId = contentId.substring("cid:".length());
|
||||
|
|
|
|||
|
|
@ -173,6 +173,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
|
|||
// Supported Marshalling
|
||||
//
|
||||
|
||||
@Override
|
||||
protected void marshalOutputStream(Object graph, OutputStream outputStream)
|
||||
throws XmlMappingException, IOException {
|
||||
try {
|
||||
|
|
@ -184,6 +185,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void marshalWriter(Object graph, Writer writer) throws XmlMappingException, IOException {
|
||||
try {
|
||||
IMarshallingContext marshallingContext = createMarshallingContext();
|
||||
|
|
@ -194,6 +196,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void marshalXmlStreamWriter(Object graph, XMLStreamWriter streamWriter) throws XmlMappingException {
|
||||
try {
|
||||
MarshallingContext marshallingContext = (MarshallingContext) createMarshallingContext();
|
||||
|
|
@ -210,6 +213,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
|
|||
// Unsupported Marshalling
|
||||
//
|
||||
|
||||
@Override
|
||||
protected void marshalDomNode(Object graph, Node node) throws XmlMappingException {
|
||||
try {
|
||||
// JiBX does not support DOM natively, so we write to a buffer first, and transform that to the Node
|
||||
|
|
@ -227,6 +231,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void marshalSaxHandlers(Object graph, ContentHandler contentHandler, LexicalHandler lexicalHandler)
|
||||
throws XmlMappingException {
|
||||
try {
|
||||
|
|
@ -247,6 +252,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void marshalXmlEventWriter(Object graph, XMLEventWriter eventWriter) {
|
||||
ContentHandler contentHandler = new StaxEventContentHandler(eventWriter);
|
||||
marshalSaxHandlers(graph, contentHandler, null);
|
||||
|
|
@ -256,6 +262,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
|
|||
// Unmarshalling
|
||||
//
|
||||
|
||||
@Override
|
||||
protected Object unmarshalInputStream(InputStream inputStream) throws XmlMappingException, IOException {
|
||||
try {
|
||||
IUnmarshallingContext unmarshallingContext = createUnmarshallingContext();
|
||||
|
|
@ -266,6 +273,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object unmarshalReader(Reader reader) throws XmlMappingException, IOException {
|
||||
try {
|
||||
IUnmarshallingContext unmarshallingContext = createUnmarshallingContext();
|
||||
|
|
@ -276,6 +284,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object unmarshalXmlStreamReader(XMLStreamReader streamReader) {
|
||||
try {
|
||||
UnmarshallingContext unmarshallingContext = (UnmarshallingContext) createUnmarshallingContext();
|
||||
|
|
@ -288,6 +297,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object unmarshalXmlEventReader(XMLEventReader eventReader) {
|
||||
try {
|
||||
XMLStreamReader streamReader = new XmlEventStreamReader(eventReader);
|
||||
|
|
@ -302,6 +312,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
|
|||
// Unsupported Unmarshalling
|
||||
//
|
||||
|
||||
@Override
|
||||
protected Object unmarshalDomNode(Node node) throws XmlMappingException {
|
||||
try {
|
||||
Transformer transformer = transformerFactory.newTransformer();
|
||||
|
|
@ -318,6 +329,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object unmarshalSaxReader(XMLReader xmlReader, InputSource inputSource)
|
||||
throws XmlMappingException, IOException {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ public class XmlBeansMarshaller extends AbstractMarshaller {
|
|||
return XmlObject.class.isAssignableFrom(clazz);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void marshalDomNode(Object graph, Node node) throws XmlMappingException {
|
||||
Document document = node.getNodeType() == Node.DOCUMENT_NODE ? (Document) node : node.getOwnerDocument();
|
||||
Node xmlBeansNode = ((XmlObject) graph).newDomNode(getXmlOptions());
|
||||
|
|
@ -99,11 +100,13 @@ public class XmlBeansMarshaller extends AbstractMarshaller {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void marshalOutputStream(Object graph, OutputStream outputStream)
|
||||
throws XmlMappingException, IOException {
|
||||
((XmlObject) graph).save(outputStream, getXmlOptions());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void marshalSaxHandlers(Object graph, ContentHandler contentHandler, LexicalHandler lexicalHandler)
|
||||
throws XmlMappingException {
|
||||
try {
|
||||
|
|
@ -114,20 +117,24 @@ public class XmlBeansMarshaller extends AbstractMarshaller {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void marshalWriter(Object graph, Writer writer) throws XmlMappingException, IOException {
|
||||
((XmlObject) graph).save(writer, getXmlOptions());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void marshalXmlEventWriter(Object graph, XMLEventWriter eventWriter) {
|
||||
ContentHandler contentHandler = new StaxEventContentHandler(eventWriter);
|
||||
marshalSaxHandlers(graph, contentHandler, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void marshalXmlStreamWriter(Object graph, XMLStreamWriter streamWriter) throws XmlMappingException {
|
||||
ContentHandler contentHandler = new StaxStreamContentHandler(streamWriter);
|
||||
marshalSaxHandlers(graph, contentHandler, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final Object unmarshalDomNode(Node node) throws XmlMappingException {
|
||||
try {
|
||||
XmlObject object = XmlObject.Factory.parse(node, getXmlOptions());
|
||||
|
|
@ -139,6 +146,7 @@ public class XmlBeansMarshaller extends AbstractMarshaller {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final Object unmarshalInputStream(InputStream inputStream) throws XmlMappingException, IOException {
|
||||
try {
|
||||
XmlObject object = XmlObject.Factory.parse(inputStream, getXmlOptions());
|
||||
|
|
@ -150,6 +158,7 @@ public class XmlBeansMarshaller extends AbstractMarshaller {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final Object unmarshalReader(Reader reader) throws XmlMappingException, IOException {
|
||||
try {
|
||||
XmlObject object = XmlObject.Factory.parse(reader, getXmlOptions());
|
||||
|
|
@ -161,6 +170,7 @@ public class XmlBeansMarshaller extends AbstractMarshaller {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final Object unmarshalSaxReader(XMLReader xmlReader, InputSource inputSource)
|
||||
throws XmlMappingException, IOException {
|
||||
XmlSaxHandler saxHandler = XmlObject.Factory.newXmlSaxHandler(getXmlOptions());
|
||||
|
|
@ -188,6 +198,7 @@ public class XmlBeansMarshaller extends AbstractMarshaller {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final Object unmarshalXmlEventReader(XMLEventReader eventReader) throws XmlMappingException {
|
||||
XMLReader reader = new StaxEventXmlReader(eventReader);
|
||||
try {
|
||||
|
|
@ -198,6 +209,7 @@ public class XmlBeansMarshaller extends AbstractMarshaller {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final Object unmarshalXmlStreamReader(XMLStreamReader streamReader) throws XmlMappingException {
|
||||
try {
|
||||
XmlObject object = XmlObject.Factory.parse(streamReader, getXmlOptions());
|
||||
|
|
|
|||
|
|
@ -348,6 +348,7 @@ public class XStreamMarshaller extends AbstractMarshaller {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void marshalDomNode(Object graph, Node node) throws XmlMappingException {
|
||||
HierarchicalStreamWriter streamWriter;
|
||||
if (node instanceof Document) {
|
||||
|
|
@ -362,11 +363,13 @@ public class XStreamMarshaller extends AbstractMarshaller {
|
|||
marshal(graph, streamWriter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void marshalXmlEventWriter(Object graph, XMLEventWriter eventWriter) throws XmlMappingException {
|
||||
ContentHandler contentHandler = new StaxEventContentHandler(eventWriter);
|
||||
marshalSaxHandlers(graph, contentHandler, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void marshalXmlStreamWriter(Object graph, XMLStreamWriter streamWriter) throws XmlMappingException {
|
||||
try {
|
||||
marshal(graph, new StaxWriter(new QNameMap(), streamWriter));
|
||||
|
|
@ -376,11 +379,13 @@ public class XStreamMarshaller extends AbstractMarshaller {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void marshalOutputStream(Object graph, OutputStream outputStream)
|
||||
throws XmlMappingException, IOException {
|
||||
marshalWriter(graph, new OutputStreamWriter(outputStream, getEncoding()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void marshalSaxHandlers(Object graph, ContentHandler contentHandler, LexicalHandler lexicalHandler)
|
||||
throws XmlMappingException {
|
||||
SaxWriter saxWriter = new SaxWriter();
|
||||
|
|
@ -388,6 +393,7 @@ public class XStreamMarshaller extends AbstractMarshaller {
|
|||
marshal(graph, saxWriter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void marshalWriter(Object graph, Writer writer) throws XmlMappingException, IOException {
|
||||
if (streamDriver != null) {
|
||||
marshal(graph, streamDriver.createWriter(writer));
|
||||
|
|
@ -410,6 +416,7 @@ public class XStreamMarshaller extends AbstractMarshaller {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object unmarshalDomNode(Node node) throws XmlMappingException {
|
||||
HierarchicalStreamReader streamReader;
|
||||
if (node instanceof Document) {
|
||||
|
|
@ -424,6 +431,7 @@ public class XStreamMarshaller extends AbstractMarshaller {
|
|||
return unmarshal(streamReader);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object unmarshalXmlEventReader(XMLEventReader eventReader) throws XmlMappingException {
|
||||
try {
|
||||
XMLStreamReader streamReader = new XmlEventStreamReader(eventReader);
|
||||
|
|
@ -434,14 +442,17 @@ public class XStreamMarshaller extends AbstractMarshaller {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object unmarshalXmlStreamReader(XMLStreamReader streamReader) throws XmlMappingException {
|
||||
return unmarshal(new StaxReader(new QNameMap(), streamReader));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object unmarshalInputStream(InputStream inputStream) throws XmlMappingException, IOException {
|
||||
return unmarshalReader(new InputStreamReader(inputStream, getEncoding()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object unmarshalReader(Reader reader) throws XmlMappingException, IOException {
|
||||
if (streamDriver != null) {
|
||||
return unmarshal(streamDriver.createReader(reader));
|
||||
|
|
@ -451,6 +462,7 @@ public class XStreamMarshaller extends AbstractMarshaller {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object unmarshalSaxReader(XMLReader xmlReader, InputSource inputSource)
|
||||
throws XmlMappingException, IOException {
|
||||
throw new UnsupportedOperationException(
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import org.xml.sax.ContentHandler;
|
|||
|
||||
public class CastorMarshallerTest extends AbstractMarshallerTestCase {
|
||||
|
||||
@Override
|
||||
protected Marshaller createMarshaller() throws Exception {
|
||||
CastorMarshaller marshaller = new CastorMarshaller();
|
||||
ClassPathResource mappingLocation = new ClassPathResource("mapping.xml", CastorMarshaller.class);
|
||||
|
|
@ -33,6 +34,7 @@ public class CastorMarshallerTest extends AbstractMarshallerTestCase {
|
|||
return marshaller;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object createFlights() {
|
||||
Flight flight = new Flight();
|
||||
flight.setNumber(42L);
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import org.springframework.oxm.Unmarshaller;
|
|||
|
||||
public class CastorUnmarshallerTest extends AbstractUnmarshallerTestCase {
|
||||
|
||||
@Override
|
||||
protected void testFlights(Object o) {
|
||||
Flights flights = (Flights) o;
|
||||
assertNotNull("Flights is null", flights);
|
||||
|
|
@ -32,12 +33,14 @@ public class CastorUnmarshallerTest extends AbstractUnmarshallerTestCase {
|
|||
testFlight(flights.getFlight()[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void testFlight(Object o) {
|
||||
Flight flight = (Flight) o;
|
||||
assertNotNull("Flight is null", flight);
|
||||
assertEquals("Number is invalid", 42L, flight.getNumber());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Unmarshaller createUnmarshaller() throws Exception {
|
||||
CastorMarshaller marshaller = new CastorMarshaller();
|
||||
ClassPathResource mappingLocation = new ClassPathResource("mapping.xml", CastorMarshaller.class);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ public class Jaxb1MarshallerTest extends AbstractJaxbMarshallerTestCase {
|
|||
|
||||
private static final String CONTEXT_PATH = "org.springframework.oxm.jaxb1";
|
||||
|
||||
@Override
|
||||
protected final Marshaller createMarshaller() throws Exception {
|
||||
Jaxb1Marshaller marshaller = new Jaxb1Marshaller();
|
||||
marshaller.setContextPaths(new String[]{CONTEXT_PATH});
|
||||
|
|
@ -36,6 +37,7 @@ public class Jaxb1MarshallerTest extends AbstractJaxbMarshallerTestCase {
|
|||
return marshaller;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object createFlights() {
|
||||
FlightType flight = new FlightTypeImpl();
|
||||
flight.setNumber(42L);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import org.springframework.oxm.jaxb1.Flights;
|
|||
|
||||
public class Jaxb1UnmarshallerTest extends AbstractUnmarshallerTestCase {
|
||||
|
||||
@Override
|
||||
protected Unmarshaller createUnmarshaller() throws Exception {
|
||||
Jaxb1Marshaller marshaller = new Jaxb1Marshaller();
|
||||
marshaller.setContextPath("org.springframework.oxm.jaxb1");
|
||||
|
|
@ -30,6 +31,7 @@ public class Jaxb1UnmarshallerTest extends AbstractUnmarshallerTestCase {
|
|||
return marshaller;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void testFlights(Object o) {
|
||||
Flights flights = (Flights) o;
|
||||
assertNotNull("Flights is null", flights);
|
||||
|
|
@ -37,6 +39,7 @@ public class Jaxb1UnmarshallerTest extends AbstractUnmarshallerTestCase {
|
|||
testFlight(flights.getFlight().get(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void testFlight(Object o) {
|
||||
FlightType flight = (FlightType) o;
|
||||
assertNotNull("Flight is null", flight);
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import org.springframework.xml.transform.StringResult;
|
|||
|
||||
public class JibxMarshallerTest extends AbstractMarshallerTestCase {
|
||||
|
||||
@Override
|
||||
protected Marshaller createMarshaller() throws Exception {
|
||||
JibxMarshaller marshaller = new JibxMarshaller();
|
||||
marshaller.setTargetClass(Flights.class);
|
||||
|
|
@ -31,6 +32,7 @@ public class JibxMarshallerTest extends AbstractMarshallerTestCase {
|
|||
return marshaller;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object createFlights() {
|
||||
Flights flights = new Flights();
|
||||
FlightType flight = new FlightType();
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import org.springframework.oxm.Unmarshaller;
|
|||
|
||||
public class JibxUnmarshallerTest extends AbstractUnmarshallerTestCase {
|
||||
|
||||
@Override
|
||||
protected Unmarshaller createUnmarshaller() throws Exception {
|
||||
JibxMarshaller unmarshaller = new JibxMarshaller();
|
||||
unmarshaller.setTargetClass(Flights.class);
|
||||
|
|
@ -27,6 +28,7 @@ public class JibxUnmarshallerTest extends AbstractUnmarshallerTestCase {
|
|||
return unmarshaller;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void testFlights(Object o) {
|
||||
Flights flights = (Flights) o;
|
||||
assertNotNull("Flights is null", flights);
|
||||
|
|
@ -34,12 +36,14 @@ public class JibxUnmarshallerTest extends AbstractUnmarshallerTestCase {
|
|||
testFlight(flights.getFlight(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void testFlight(Object o) {
|
||||
FlightType flight = (FlightType) o;
|
||||
assertNotNull("Flight is null", flight);
|
||||
assertEquals("Number is invalid", 42L, flight.getNumber());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testUnmarshalPartialStaxSourceXmlStreamReader() throws Exception {
|
||||
// JiBX does not support reading XML fragments, hence the override here
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import org.springframework.samples.flight.FlightsDocument.Flights;
|
|||
|
||||
public class XmlBeansMarshallerTest extends AbstractMarshallerTestCase {
|
||||
|
||||
@Override
|
||||
protected Marshaller createMarshaller() throws Exception {
|
||||
return new XmlBeansMarshaller();
|
||||
}
|
||||
|
|
@ -41,6 +42,7 @@ public class XmlBeansMarshallerTest extends AbstractMarshallerTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object createFlights() {
|
||||
FlightsDocument flightsDocument = FlightsDocument.Factory.newInstance();
|
||||
Flights flights = flightsDocument.addNewFlights();
|
||||
|
|
|
|||
|
|
@ -31,10 +31,12 @@ import org.springframework.xml.transform.StringSource;
|
|||
|
||||
public class XmlBeansUnmarshallerTest extends AbstractUnmarshallerTestCase {
|
||||
|
||||
@Override
|
||||
protected Unmarshaller createUnmarshaller() throws Exception {
|
||||
return new XmlBeansMarshaller();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void testFlights(Object o) {
|
||||
FlightsDocument flightsDocument = (FlightsDocument) o;
|
||||
assertNotNull("FlightsDocument is null", flightsDocument);
|
||||
|
|
@ -43,6 +45,7 @@ public class XmlBeansUnmarshallerTest extends AbstractUnmarshallerTestCase {
|
|||
testFlight(flights.getFlightArray(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void testFlight(Object o) {
|
||||
FlightType flight = null;
|
||||
if (o instanceof FlightType) {
|
||||
|
|
@ -56,6 +59,7 @@ public class XmlBeansUnmarshallerTest extends AbstractUnmarshallerTestCase {
|
|||
assertEquals("Number is invalid", 42L, flight.getNumber());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testUnmarshalPartialStaxSourceXmlStreamReader() throws Exception {
|
||||
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
|
||||
XMLStreamReader streamReader = inputFactory.createXMLStreamReader(new StringReader(INPUT_STRING));
|
||||
|
|
|
|||
Loading…
Reference in New Issue