DataFeedMessageSerializerpublic class DataFeedMessageSerializer extends Object implements Deserializer, Serializer
Constructors Summary |
---|
public DataFeedMessageSerializer()
|
Methods Summary |
---|
public void | marshall(java.lang.String inScopeEncStyle, java.lang.Class javaType, java.lang.Object src, java.lang.Object context, java.io.Writer sink, NSStack nsStack, XMLJavaMappingRegistry xjmr, org.apache.soap.rpc.SOAPContext ctx)
if(!javaType.equals(DataFeedMessage.class)) {
throw new IllegalArgumentException(
"Can only serialize javasoap.book.ch6.DataFeedMessage instances");
}
nsStack.pushScope();
if (src != null)
{
SoapEncUtils.generateStructureHeader(inScopeEncStyle,
javaType, context,
sink, nsStack, xjmr);
DataFeedMessage msg = (DataFeedMessage)src;
String data = msg.toString();
sink.write(data);
sink.write("</" + context + '>");
}
else
{
SoapEncUtils.generateNullStructure(inScopeEncStyle,
javaType, context,
sink, nsStack, xjmr);
}
nsStack.popScope();
| public Bean | unmarshall(java.lang.String inScopeEncStyle, QName elementType, org.w3c.dom.Node src, XMLJavaMappingRegistry xjmr, org.apache.soap.rpc.SOAPContext ctx)
Element elem = (Element)src;
String value = DOMUtils.getChildCharacterData(elem);
DataFeedMessage msg = null;
if(value!=null && !((value=value.trim()).equals("")) {
msg = new DataFeedMessage();
msg.parseFormattedMessage(value);
}
return new Bean(DataFeedMessage.class, msg);
|
|