C# Class SimpleFramework.Xml.Core.ElementArrayLabel

The ElementArrayLabel represents a label that is used to represent an XML element array in a class schema. This element array label can be used to convert an XML node into an array of composite or primitive objects. If the array is of primitive types then the entry attribute must be specified so that the primitive values can be serialized in a structured manner.
Inheritance: Label
Datei anzeigen Open project: ngallagher/simplexml

Public Methods

Method Description
ElementArrayLabel ( Contact contact, ElementArray label ) : SimpleFramework.Xml.Strategy

Constructor for the ElementArrayLabel object. This creates a label object, which can be used to convert an element node to an array of XML serializable objects.

GetConverter ( Context context ) : Converter
GetConverter ( Context context, String name ) : Converter

This will create a Converter for transforming an XML element into an array of XML serializable objects. The XML schema class for these objects must present the element array annotation.

GetEmpty ( Context context ) : Object

This is used to provide a configured empty value used when the annotated value is null. This ensures that XML can be created with required details regardless of whether values are null or not. It also provides a means for sensible default values.

GetEntry ( Context context ) : String

This is used to either provide the entry value provided within the annotation or compute a entry value. If the entry string is not provided the the entry value is calculated as the type of primitive the object is as a simplified class name.

GetName ( Context context ) : String

This is used to acquire the name of the element or attribute that is used by the class schema. The name is determined by checking for an override within the annotation. If it contains a name then that is used, if however the annotation does not specify a name the the field or method name is used instead.

IsAttribute ( ) : bool
IsCollection ( ) : bool

This is used to determine if the label is a collection. If the label represents a collection then any original assignment to the field or method can be written to without the need to create a new collection. This allows obscure collections to be used and also allows initial entries to be maintained.

IsData ( ) : bool

This is used to determine whether the annotation requires it and its children to be written as a CDATA block. This is done when a primitive or other such element requires a text value and that value needs to be encapsulated within a CDATA block.

IsInline ( ) : bool

This method is used by the deserialization process to check to see if an annotation is inline or not. If an annotation represents an inline XML entity then the deserialization and serialization process ignores overrides and special attributes. By default element arrays are not inline.

IsRequired ( ) : bool

This is used to determine whether the XML element is required. This ensures that if an XML element is missing from a document that deserialization can continue. Also, in the process of serialization, if a value is null it does not need to be written to the resulting XML document.

ToString ( ) : String

This is used to describe the annotation and method or field that this label represents. This is used to provide error messages that can be used to debug issues that occur when processing a method. This will provide enough information such that the problem can be isolated correctly.

Method Details

ElementArrayLabel() public method

Constructor for the ElementArrayLabel object. This creates a label object, which can be used to convert an element node to an array of XML serializable objects.
public ElementArrayLabel ( Contact contact, ElementArray label ) : SimpleFramework.Xml.Strategy
contact Contact /// this is the contact that this label represents ///
label SimpleFramework.Xml.ElementArray /// the annotation that contains the schema details ///
return SimpleFramework.Xml.Strategy

GetConverter() public method

public GetConverter ( Context context ) : Converter
context Context /// this is the context object used for serialization ///
return Converter

GetConverter() public method

This will create a Converter for transforming an XML element into an array of XML serializable objects. The XML schema class for these objects must present the element array annotation.
public GetConverter ( Context context, String name ) : Converter
context Context /// this is the context object used for serialization ///
name String /// this is the name of the entry XML element to use ///
return Converter

GetEmpty() public method

This is used to provide a configured empty value used when the annotated value is null. This ensures that XML can be created with required details regardless of whether values are null or not. It also provides a means for sensible default values.
public GetEmpty ( Context context ) : Object
context Context /// this is the context object for the serialization ///
return Object

GetEntry() public method

This is used to either provide the entry value provided within the annotation or compute a entry value. If the entry string is not provided the the entry value is calculated as the type of primitive the object is as a simplified class name.
public GetEntry ( Context context ) : String
context Context /// this is the context used to style the entry ///
return String

GetName() public method

This is used to acquire the name of the element or attribute that is used by the class schema. The name is determined by checking for an override within the annotation. If it contains a name then that is used, if however the annotation does not specify a name the the field or method name is used instead.
public GetName ( Context context ) : String
context Context /// this is the context used to style the name ///
return String

IsAttribute() public method

public IsAttribute ( ) : bool
return bool

IsCollection() public method

This is used to determine if the label is a collection. If the label represents a collection then any original assignment to the field or method can be written to without the need to create a new collection. This allows obscure collections to be used and also allows initial entries to be maintained.
public IsCollection ( ) : bool
return bool

IsData() public method

This is used to determine whether the annotation requires it and its children to be written as a CDATA block. This is done when a primitive or other such element requires a text value and that value needs to be encapsulated within a CDATA block.
public IsData ( ) : bool
return bool

IsInline() public method

This method is used by the deserialization process to check to see if an annotation is inline or not. If an annotation represents an inline XML entity then the deserialization and serialization process ignores overrides and special attributes. By default element arrays are not inline.
public IsInline ( ) : bool
return bool

IsRequired() public method

This is used to determine whether the XML element is required. This ensures that if an XML element is missing from a document that deserialization can continue. Also, in the process of serialization, if a value is null it does not need to be written to the resulting XML document.
public IsRequired ( ) : bool
return bool

ToString() public method

This is used to describe the annotation and method or field that this label represents. This is used to provide error messages that can be used to debug issues that occur when processing a method. This will provide enough information such that the problem can be isolated correctly.
public ToString ( ) : String
return String