Use StandardPayload<T> and StandardClasses for:
public static org.w3c.dom.Document getMarshalledDocument(Object value, QName name) {
if (log.isDebugEnabled())
log.debug("JAXBEventTransformer.getMarshalledDocument() value = " + value);
try {
String toenum = value.getClass().getSimpleName();
if (log.isDebugEnabled())
log.debug("JAXBEventTransformer.getMarshalledDocument() toenum = " + toenum);
StandardClasses t = null;
try {
t = StandardClasses.valueOf(toenum.toUpperCase());
} catch (java.lang.IllegalArgumentException e) {
return null;
}
if (log.isDebugEnabled())
log.debug("JAXBEventTransformer.getMarshalledDocument() t = " + t);
return t.getMarshalledDocument(value, name);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
private static Object getUnmarshalledObject(QName type, EventPayload payload) {
try {
String source = type.getLocalPart();
String toenum = source.substring(source.lastIndexOf(".") + 1);
if (log.isDebugEnabled())
log.debug("JAXBEventTransformer.getUnmarshalledObject() toenum = " + toenum);
StandardClasses t = null;
try {
t = StandardClasses.valueOf(toenum.toUpperCase());
} catch (java.lang.IllegalArgumentException e) {
return null;
}
if (log.isDebugEnabled())
log.debug("JAXBEventTransformer.getUnmarshalledObject() t = " + t);
return t.getUnmarshalledObject(type, payload);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
==================
public class StandardPayload<> {
public org.w3c.dom.Document getMarshalledDocument(Object value, QName name) {
public T getUnmarshalledObject(QName type, EventPayload payload) {
public enum StandardClasses {
StandardClasses(StandardPayload< ? > s) {
public org.w3c.dom.Document getMarshalledDocument(Object value, QName name) {
public Object getUnmarshalledObject(QName type, EventPayload payload) {
=================
Thursday, September 4, 2008
JAXB for standard java classes to marshal and unmarshal
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment