public GetText ( Object source ) : String | ||
source | Object | /// this is the object instance to get the value of /// |
return | String |
/// <summary> /// This <c>write</c> method will serialize the contents of /// the provided object to the given XML element. This will use /// the <c>String.valueOf</c> method to convert the object to /// a string if the object represents a primitive, if however the /// object represents an enumerated type then the text value is /// created using <c>Enum.name</c>. /// </summary> /// <param name="source"> /// this is the object to be serialized /// </param> /// <param name="node"> /// this is the XML element to have its text set /// </param> public void Write(OutputNode node, Object source) { String text = factory.GetText(source); if (text != null) { node.setValue(text); } }
/// <summary> /// This method is used to write the value to the specified node. /// This will write the item as an attribute to the provided node, /// the name of the attribute is taken from the annotation. /// </summary> /// <param name="node"> /// this is the node that the value is written to /// </param> /// <param name="item"> /// this is the item that is to be written /// </param> public void WriteAttribute(OutputNode node, Object item) { Class expect = type.Type; String text = factory.GetText(item); String key = entry.Key; if (key == null) { key = context.GetName(expect); } String name = style.GetAttribute(key); if (text != null) { node.setAttribute(name, text); } }