SWS-229 in 1.0 branch
This commit is contained in:
@@ -49,6 +49,12 @@ import org.jibx.runtime.impl.MarshallingContext;
|
||||
import org.jibx.runtime.impl.StAXReaderWrapper;
|
||||
import org.jibx.runtime.impl.StAXWriter;
|
||||
import org.jibx.runtime.impl.UnmarshallingContext;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.ext.LexicalHandler;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.oxm.AbstractMarshaller;
|
||||
import org.springframework.oxm.XmlMappingException;
|
||||
@@ -56,11 +62,6 @@ import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.xml.stream.StaxEventContentHandler;
|
||||
import org.springframework.xml.stream.XmlEventStreamReader;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.ext.LexicalHandler;
|
||||
|
||||
/**
|
||||
* Implementation of the <code>Marshaller</code> and <code>Unmarshaller</code> interfaces for JiBX.
|
||||
@@ -138,7 +139,15 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
|
||||
}
|
||||
|
||||
public boolean supports(Class clazz) {
|
||||
return targetClass.isAssignableFrom(clazz);
|
||||
Assert.notNull(clazz, "'clazz' must not be null");
|
||||
String[] mappedClasses = bindingFactory.getMappedClasses();
|
||||
String className = clazz.getName();
|
||||
for (int i = 0; i < mappedClasses.length; i++) {
|
||||
if (className.equals(mappedClasses[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.oxm.jibx;
|
||||
|
||||
import org.custommonkey.xmlunit.XMLUnit;
|
||||
|
||||
import org.springframework.oxm.AbstractMarshallerTestCase;
|
||||
import org.springframework.oxm.Marshaller;
|
||||
import org.springframework.xml.transform.StringResult;
|
||||
@@ -69,7 +70,9 @@ public class JibxMarshallerTest extends AbstractMarshallerTestCase {
|
||||
}
|
||||
|
||||
public void testSupports() throws Exception {
|
||||
assertTrue("Jaxb2Marshaller does not support Flights", marshaller.supports(Flights.class));
|
||||
assertTrue("JibxMarshaller does not support Flights", marshaller.supports(Flights.class));
|
||||
assertTrue("JibxMarshaller does not support FlightType", marshaller.supports(FlightType.class));
|
||||
assertFalse("JibxMarshaller supports illegal type", marshaller.supports(getClass()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user