axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Taras Shkvarchuk <tar...@grandcentral.com>
Subject [PATCH] message.MessageElement get/setValue() and child serializa tion
Date Fri, 15 Feb 2002 13:30:53 GMT
org.apache.axis.message.MessageElement:

added Object getValue()/setValue(Object) methods.
makes it a lot easier to build nodes with registered types as values.

Fixed output() method to serialize any children node may have.

-Taras

61a62
> import org.apache.axis.encoding.Serializer;
80a82
> import java.util.Iterator;
87a90,91
> 	private Object mValue=null;
> 
207a212,235
> 	public Object getValue() throws Exception{
> 		if(mValue==null){
> 			QName myType=getType();
> 			if(myType==null){
> 				String
typeStr=attributes.getValue("xsi","type");
> 				if(typeStr!=null){
> 					int colPos=typeStr.indexOf(':');
> 					if(colPos!=-1){
> 						myType=new
QName(typeStr.substring(0,colPos),typeStr.substring(colPos+1));
> 					}else{
> 						myType=new
QName("",typeStr);
> 					}
> 					setType(myType);
> 				}
> 			}
> 			mValue=getValueAsType(myType);
> 		}
> 		return mValue;
> 	}
> 
> 	public void setValue(Object newValue){
> 		this.mValue=newValue;
> 	}
> 
310a339,341
> 		if(typeQName==null){
> 			setType(type);
> 		}
468a500,508
> 		if(mValue!=null){
> 			Serializer
typeSerial=context.getSerializerForJavaType(mValue.getClass());
> 			if(typeSerial!=null){
> 				typeSerial.serialize(new QName(namespaceURI,
name),attributes,mValue,context);
> 				return;
> 			}
> 		}
> 
> 
499a540,545
> 		if(children!=null){
> 			for(Iterator it=children.iterator();it.hasNext();){
> 				MessageElement
child=(MessageElement)it.next();
> 				child.output(context);
> 			}
> 		}

Mime
View raw message