C# Class SimpleFramework.Xml.Core.PrimitiveList

The PrimitiveList object is used to convert an element list to a collection of element entries. This in effect performs a serialization and deserialization of primitive entry elements for the collection object. On serialization each objects type must be checked against the XML annotation entry so that it is serialized in a form that can be deserialized. <list> <entry>example one</entry> <entry>example two</entry> <entry>example three</entry> <entry>example four</entry> </list> For the above XML element list the element entry is used to wrap the primitive string value. This wrapping XML element is configurable and defaults to the lower case string for the name of the class it represents. So, for example, if the primitive type is an int the enclosing element will be called int.
Inheritance: Converter
显示文件 Open project: ngallagher/simplexml

Public Methods

Method Description
IsOverridden ( OutputNode node, Object value ) : bool

This is used to determine whether the specified value has been overridden by the strategy. If the item has been overridden then no more serialization is require for that value, this is effectively telling the serialization process to stop writing.

Populate ( InputNode node, Object result ) : Object

This populate method wll read the XML element list from the provided node and deserialize its children as entry types. This will deserialize each entry type as a primitive value. In order to do this the parent string provided forms the element.

PrimitiveList ( Context context, Type type, Type entry, String parent ) : SimpleFramework.Xml.Strategy

Constructor for the PrimitiveList object. This is given the list type and entry type to be used. The list type is the Collection implementation that deserialized entry objects are inserted into.

Read ( InputNode node ) : Object

This read method will read the XML element list from the provided node and deserialize its children as entry types. This will deserialize each entry type as a primitive value. In order to do this the parent string provided forms the element.

Read ( InputNode node, Object result ) : Object

This read method will read the XML element map from the provided node and deserialize its children as entry types. Each entry type must contain a key and value so that the entry can be inserted in to the map as a pair. If either the key or value is composite it is read as a root object, which means its Root annotation must be present and the name of the object element must match that root element name.

Validate ( InputNode node ) : bool

This validate method wll validate the XML element list from the provided node and validate its children as entry types. This will validate each entry type as a primitive value. In order to do this the parent string provided forms the element.

Validate ( InputNode node, Class type ) : bool

This validate method will validate the XML element list from the provided node and validate its children as entry types. This will validate each entry type as a primitive value. In order to do this the parent string provided forms the element.

Write ( OutputNode node, Object source ) : void

This write method will write the specified object to the given XML element as as list entries. Each entry within the given list must be assignable to the given primitive type. This will deserialize each entry type as a primitive value. In order to do this the parent string provided forms the element.

Method Details

IsOverridden() public method

This is used to determine whether the specified value has been overridden by the strategy. If the item has been overridden then no more serialization is require for that value, this is effectively telling the serialization process to stop writing.
public IsOverridden ( OutputNode node, Object value ) : bool
node OutputNode /// the node that a potential override is written to ///
value Object /// this is the object instance to be serialized ///
return bool

Populate() public method

This populate method wll read the XML element list from the provided node and deserialize its children as entry types. This will deserialize each entry type as a primitive value. In order to do this the parent string provided forms the element.
public Populate ( InputNode node, Object result ) : Object
node InputNode /// this is the XML element that is to be deserialized ///
result Object /// this is the collection that is to be populated ///
return Object

PrimitiveList() public method

Constructor for the PrimitiveList object. This is given the list type and entry type to be used. The list type is the Collection implementation that deserialized entry objects are inserted into.
public PrimitiveList ( Context context, Type type, Type entry, String parent ) : SimpleFramework.Xml.Strategy
context Context /// this is the context object used for serialization ///
type System.Type /// this is the collection type for the list used ///
entry System.Type /// the primitive type to be stored within the list ///
parent String /// this is the name to wrap the list element with ///
return SimpleFramework.Xml.Strategy

Read() public method

This read method will read the XML element list from the provided node and deserialize its children as entry types. This will deserialize each entry type as a primitive value. In order to do this the parent string provided forms the element.
public Read ( InputNode node ) : Object
node InputNode /// this is the XML element that is to be deserialized ///
return Object

Read() public method

This read method will read the XML element map from the provided node and deserialize its children as entry types. Each entry type must contain a key and value so that the entry can be inserted in to the map as a pair. If either the key or value is composite it is read as a root object, which means its Root annotation must be present and the name of the object element must match that root element name.
public Read ( InputNode node, Object result ) : Object
node InputNode /// this is the XML element that is to be deserialized ///
result Object /// this is the map object that is to be populated ///
return Object

Validate() public method

This validate method wll validate the XML element list from the provided node and validate its children as entry types. This will validate each entry type as a primitive value. In order to do this the parent string provided forms the element.
public Validate ( InputNode node ) : bool
node InputNode /// this is the XML element that is to be deserialized ///
return bool

Validate() public method

This validate method will validate the XML element list from the provided node and validate its children as entry types. This will validate each entry type as a primitive value. In order to do this the parent string provided forms the element.
public Validate ( InputNode node, Class type ) : bool
node InputNode /// this is the XML element that is to be deserialized ///
type Class /// this is the type to validate against the input node ///
return bool

Write() public method

This write method will write the specified object to the given XML element as as list entries. Each entry within the given list must be assignable to the given primitive type. This will deserialize each entry type as a primitive value. In order to do this the parent string provided forms the element.
public Write ( OutputNode node, Object source ) : void
node OutputNode /// this is the XML element container to be populated ///
source Object /// this is the source object array to be serialized ///
return void