C# Класс SimpleFramework.Xml.Core.CompositeArray

The CompositeArray object is used to convert a list of elements to an array of object entries. This in effect performs a root serialization and deserialization of entry elements for the array object. On serialization each objects type must be checked against the array component type so that it is serialized in a form that can be deserialized dynamically. <array length="2"> <entry> <text>example text value</text> </entry> <entry> <text>some other example</text> </entry> </array> For the above XML element list the element entry is contained within the array. Each entry element is deserialized as a root element and then inserted into the array. For serialization the reverse is done, each element taken from the array is written as a root element to the parent element to create the list. Entry objects do not need to be of the same type.
Наследование: Converter
Показать файл Открыть проект

Открытые методы

Метод Описание
CompositeArray ( Context context, Type type, Type entry, String parent ) : SimpleFramework.Xml.Strategy

Constructor for the CompositeArray object. This is given the array type for the contact that is to be converted. An array of the specified type is used to hold the deserialized elements and will be the same length as the number of elements.

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 ensures each entry type is deserialized as a root type, that is, its Root annotation must be present and the name of the entry element must match that root element name.

Read ( InputNode node, Object list ) : Object

This read method will read the XML element list from the provided node and deserialize its children as entry types. This ensures each entry type is deserialized as a root type, that is, its Root annotation must be present and the name of the entry element must match that root element name.

Read ( InputNode node, Object list, int index ) : void

This is used to read the specified node from in to the list. If the node is null then this represents a null element value in the array. The node can be null only if there is a parent and that parent contains no child XML elements.

Validate ( InputNode node ) : bool

This validate method will validate the XML element list against the provided node and validate its children as entry types. This ensures each entry type is validated as a root type, that is, its Root annotation must be present and the name of the entry element must match that root element name.

Validate ( InputNode node, Class type ) : bool

This validate method wll validate the XML element list against the provided node and validate its children as entry types. This ensures each entry type is validated as a root type, that is, its Root annotation must be present and the name of the entry element must match that root element name.

Write ( OutputNode node, Object source ) : void

This write method will write the specified object to the given XML element as as array entries. Each entry within the given array must be assignable to the array component type. Each array entry is serialized as a root element, that is, its Root annotation is used to extract the name.

Описание методов

CompositeArray() публичный Метод

Constructor for the CompositeArray object. This is given the array type for the contact that is to be converted. An array of the specified type is used to hold the deserialized elements and will be the same length as the number of elements.
public CompositeArray ( 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 field type for the array being used ///
entry System.Type /// this is the entry type for the array elements ///
parent String /// this is the name to wrap the array element with ///
Результат SimpleFramework.Xml.Strategy

Read() публичный Метод

This read method will read the XML element list from the provided node and deserialize its children as entry types. This ensures each entry type is deserialized as a root type, that is, its Root annotation must be present and the name of the entry element must match that root element name.
public Read ( InputNode node ) : Object
node InputNode /// this is the XML element that is to be deserialized ///
Результат Object

Read() публичный Метод

This read method will read the XML element list from the provided node and deserialize its children as entry types. This ensures each entry type is deserialized as a root type, that is, its Root annotation must be present and the name of the entry element must match that root element name.
public Read ( InputNode node, Object list ) : Object
node InputNode /// this is the XML element that is to be deserialized ///
list Object /// this is the array that is to be deserialized ///
Результат Object

Read() публичный Метод

This is used to read the specified node from in to the list. If the node is null then this represents a null element value in the array. The node can be null only if there is a parent and that parent contains no child XML elements.
public Read ( InputNode node, Object list, int index ) : void
node InputNode /// this is the node to read the array value from ///
list Object /// this is the list to add the array value in to ///
index int /// this is the offset to set the value in the array ///
Результат void

Validate() публичный Метод

This validate method will validate the XML element list against the provided node and validate its children as entry types. This ensures each entry type is validated as a root type, that is, its Root annotation must be present and the name of the entry element must match that root element name.
public Validate ( InputNode node ) : bool
node InputNode /// this is the XML element that is to be validated ///
Результат bool

Validate() публичный Метод

This validate method wll validate the XML element list against the provided node and validate its children as entry types. This ensures each entry type is validated as a root type, that is, its Root annotation must be present and the name of the entry element must match that root element name.
public Validate ( InputNode node, Class type ) : bool
node InputNode /// this is the XML element that is to be validated ///
type Class /// this is the array type used to create the array ///
Результат bool

Write() публичный Метод

This write method will write the specified object to the given XML element as as array entries. Each entry within the given array must be assignable to the array component type. Each array entry is serialized as a root element, that is, its Root annotation is used to extract the name.
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 ///
Результат void