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

The Primitive object is used to provide serialization for primitive objects. This can serialize and deserialize any primitive object and enumerations. Primitive values are converted to text using the String.valueOf method. Enumerated types are converted using the Enum.valueOf method.

Text within attributes and elements can contain template variables similar to those found in Apache Ant. This allows values such as system properties, environment variables, and user specified mappings to be inserted into the text in place of the template reference variables. <example attribute="${value}> <text>Text with a ${variable}</text> </example> In the above XML element the template variable references will be checked against the Filter object used by the context serialization object. If they corrospond to a filtered value then they are replaced, if not the text remains unchanged.

Наследование: Converter
Показать файл Открыть проект Примеры использования класса

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

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

Constructor for the Primitive object. This is used to convert an XML node to a primitive object and vice versa. To perform deserialization the primitive object requires the context object used for the instance of serialization to performed.

Primitive ( Context context, Type type, String empty ) : SimpleFramework.Xml.Strategy

Constructor for the Primitive object. This is used to convert an XML node to a primitive object and vice versa. To perform deserialization the primitive object requires the context object used for the instance of serialization to performed.

Read ( InputNode node ) : Object

This read method will extract the text value from the node and replace any template variables before converting it to a primitive value. This uses the Context object used for this instance of serialization to replace all template variables with values from the context filter.

Read ( InputNode node, Class type ) : Object

This read method will extract the text value from the node and replace any template variables before converting it to a primitive value. This uses the Context object used for this instance of serialization to replace all template variables with values from the context filter.

Read ( InputNode node, Object value ) : Object

This read method will extract the text value from the node and replace any template variables before converting it to a primitive value. This uses the Context object used for this instance of serialization to replace all template variables with values from the context filter.

ReadElement ( InputNode node ) : Object

This read method will extract the text value from the node and replace any template variables before converting it to a primitive value. This uses the Context object used for this instance of serialization to replace all template variables with values from the context filter.

ReadElement ( InputNode node, Instance value ) : Object

This read method will extract the text value from the node and replace any template variables before converting it to a primitive value. This uses the Context object used for this instance of serialization to replace all template variables with values from the context filter.

ReadTemplate ( String value, Class type ) : Object

This read method will extract the text value from the node and replace any template variables before converting it to a primitive value. This uses the Context object used for this instance of serialization to replace all template variables with values from the context filter.

Validate ( InputNode node ) : bool

This validate method will validate the primitive by checking the node text. If the value is a reference then this will not extract any value from the node. Transformation of the extracted value is not done as it can not account for template variables. Thus any text extracted is valid.

ValidateElement ( InputNode node ) : bool

This validateElement method validates a primitive by checking the node text. If the value is a reference then this will not extract any value from the node. Transformation of the extracted value is not done as it can not account for template variables. Thus any text extracted is valid.

Write ( OutputNode node, Object source ) : void

This write method will serialize the contents of the provided object to the given XML element. This will use the String.valueOf 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 Enum.name.

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

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

Constructor for the Primitive object. This is used to convert an XML node to a primitive object and vice versa. To perform deserialization the primitive object requires the context object used for the instance of serialization to performed.
public Primitive ( Context context, Type type ) : SimpleFramework.Xml.Strategy
context Context /// the context object used for the serialization ///
type System.Type /// this is the type of primitive this represents ///
Результат SimpleFramework.Xml.Strategy

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

Constructor for the Primitive object. This is used to convert an XML node to a primitive object and vice versa. To perform deserialization the primitive object requires the context object used for the instance of serialization to performed.
public Primitive ( Context context, Type type, String empty ) : SimpleFramework.Xml.Strategy
context Context /// the context object used for the serialization ///
type System.Type /// this is the type of primitive this represents ///
empty String /// this is the value used to represent a null value ///
Результат SimpleFramework.Xml.Strategy

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

This read method will extract the text value from the node and replace any template variables before converting it to a primitive value. This uses the Context object used for this instance of serialization to replace all template variables with values from the context filter.
public Read ( InputNode node ) : Object
node InputNode /// this is the node to be converted to a primitive ///
Результат Object

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

This read method will extract the text value from the node and replace any template variables before converting it to a primitive value. This uses the Context object used for this instance of serialization to replace all template variables with values from the context filter.
public Read ( InputNode node, Class type ) : Object
node InputNode /// this is the node to be converted to a primitive ///
type Class /// this is the type to read the primitive with ///
Результат Object

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

This read method will extract the text value from the node and replace any template variables before converting it to a primitive value. This uses the Context object used for this instance of serialization to replace all template variables with values from the context filter.
public Read ( InputNode node, Object value ) : Object
node InputNode /// this is the node to be converted to a primitive ///
value Object /// this is the original primitive value used ///
Результат Object

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

This read method will extract the text value from the node and replace any template variables before converting it to a primitive value. This uses the Context object used for this instance of serialization to replace all template variables with values from the context filter.
public ReadElement ( InputNode node ) : Object
node InputNode /// this is the node to be converted to a primitive ///
Результат Object

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

This read method will extract the text value from the node and replace any template variables before converting it to a primitive value. This uses the Context object used for this instance of serialization to replace all template variables with values from the context filter.
public ReadElement ( InputNode node, Instance value ) : Object
node InputNode /// this is the node to be converted to a primitive ///
value Instance /// this is the instance to set the result to ///
Результат Object

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

This read method will extract the text value from the node and replace any template variables before converting it to a primitive value. This uses the Context object used for this instance of serialization to replace all template variables with values from the context filter.
public ReadTemplate ( String value, Class type ) : Object
value String /// this is the value to be processed as a template ///
type Class /// this is the type that that the primitive is ///
Результат Object

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

This validate method will validate the primitive by checking the node text. If the value is a reference then this will not extract any value from the node. Transformation of the extracted value is not done as it can not account for template variables. Thus any text extracted is valid.
public Validate ( InputNode node ) : bool
node InputNode /// this is the node to be validated as a primitive ///
Результат bool

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

This validateElement method validates a primitive by checking the node text. If the value is a reference then this will not extract any value from the node. Transformation of the extracted value is not done as it can not account for template variables. Thus any text extracted is valid.
public ValidateElement ( InputNode node ) : bool
node InputNode /// this is the node to be validated as a primitive ///
Результат bool

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

This write method will serialize the contents of the provided object to the given XML element. This will use the String.valueOf 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 Enum.name.
public Write ( OutputNode node, Object source ) : void
node OutputNode /// this is the XML element to have its text set ///
source Object /// this is the object to be serialized ///
Результат void