C# Class SimpleFramework.Xml.Core.PrimitiveValue

The PrimitiveValue is used to serialize a primitive value to and from a node. If a value name is provided in the annotation then this will serialize and deserialize that value with the given name, if the value is primitive and no name is specified then the value is written inline, that is without any enclosing XML element. <entry key="one">example one</entry> <entry key="two">example two</entry> <entry key="three">example three</entry> Allowing the value to be written as either an XML element or an inline text value enables a more flexible means for representing the value. The only condition for having an inline value is that the key is specified as an attribute in the annotation.
Inheritance: Converter
Exibir arquivo 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.

PrimitiveValue ( Context context, Entry entry, Type type ) : SimpleFramework.Xml.Strategy

Constructor for the PrimitiveValue object. This is used to create the value object which converts the map value to an instance of the value type. This can also resolve references.

Read ( InputNode node ) : Object

This method is used to read the value value from the node. The value read from the node is resolved using the template filter. If the value value can not be found according to the annotation attributes then an exception is thrown.

Read ( InputNode node, Object value ) : Object

This method is used to read the value value from the node. The value read from the node is resolved using the template filter. If the value value can not be found according to the annotation attributes then an exception is thrown.

Read ( InputNode node, String key ) : Object

This method is used to read the value value from the node. The value read from the node is resolved using the template filter. If the value value can not be found according to the annotation attributes then null is assumed and returned.

Validate ( InputNode node ) : bool

This method is used to read the value value from the node. The value read from the node is resolved using the template filter. If the value value can not be found according to the annotation attributes then null is assumed and the node is valid.

Validate ( InputNode node, String key ) : bool

This method is used to read the value value from the node. The value read from the node is resolved using the template filter. If the value value can not be found according to the annotation attributes then null is assumed and the node is valid.

Write ( OutputNode node, Object item ) : void

This method is used to write the value to the specified node. The value written to the node can be an attribute or an element depending on the annotation attribute values. This method will maintain references for serialized elements.

Write ( OutputNode node, Object item, String key ) : void

This method is used to write the value to the specified node. The value written to the node can be an attribute or an element depending on the annotation attribute values. This method will maintain references for serialized elements.

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

PrimitiveValue() public method

Constructor for the PrimitiveValue object. This is used to create the value object which converts the map value to an instance of the value type. This can also resolve references.
public PrimitiveValue ( Context context, Entry entry, Type type ) : SimpleFramework.Xml.Strategy
context Context /// this is the context object used for serialization ///
entry Entry /// this is the entry object that describes entries ///
type System.Type /// this is the type that this converter deals with ///
return SimpleFramework.Xml.Strategy

Read() public method

This method is used to read the value value from the node. The value read from the node is resolved using the template filter. If the value value can not be found according to the annotation attributes then an exception is thrown.
public Read ( InputNode node ) : Object
node InputNode /// this is the node to read the value object from ///
return Object

Read() public method

This method is used to read the value value from the node. The value read from the node is resolved using the template filter. If the value value can not be found according to the annotation attributes then an exception is thrown.
public Read ( InputNode node, Object value ) : Object
node InputNode /// this is the node to read the value object from ///
value Object /// this is the value to deserialize in to ///
return Object

Read() public method

This method is used to read the value value from the node. The value read from the node is resolved using the template filter. If the value value can not be found according to the annotation attributes then null is assumed and returned.
public Read ( InputNode node, String key ) : Object
node InputNode /// this is the node to read the value object from ///
key String /// this is the name of the value XML element ///
return Object

Validate() public method

This method is used to read the value value from the node. The value read from the node is resolved using the template filter. If the value value can not be found according to the annotation attributes then null is assumed and the node is valid.
public Validate ( InputNode node ) : bool
node InputNode /// this is the node to read the value object from ///
return bool

Validate() public method

This method is used to read the value value from the node. The value read from the node is resolved using the template filter. If the value value can not be found according to the annotation attributes then null is assumed and the node is valid.
public Validate ( InputNode node, String key ) : bool
node InputNode /// this is the node to read the value object from ///
key String /// this is the name of the node to be validated ///
return bool

Write() public method

This method is used to write the value to the specified node. The value written to the node can be an attribute or an element depending on the annotation attribute values. This method will maintain references for serialized elements.
public Write ( OutputNode node, Object item ) : void
node OutputNode /// this is the node that the value is written to ///
item Object /// this is the item that is to be written ///
return void

Write() public method

This method is used to write the value to the specified node. The value written to the node can be an attribute or an element depending on the annotation attribute values. This method will maintain references for serialized elements.
public Write ( OutputNode node, Object item, String key ) : void
node OutputNode /// this is the node that the value is written to ///
item Object /// this is the item that is to be written ///
key String /// this is the name of the node to be created ///
return void