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

The PrimitiveKey is used to serialize a primitive key to and from a node. If a key name is provided in the annotation then this will serialize and deserialize that key with the given name, if the key is an attribute, then it is written using the provided name. <entry key="one">example one</entry> <entry key="two">example two</entry> <entry key="three">example three</entry> Allowing the key to be written as either an XML attribute or an element enables a more flexible means for representing the key. Composite elements can not be used as attribute values as they do not serialize to a string. Primitive keys as elements can be maintained as references using the cycle strategy.
Наследование: Converter
Показать файл Открыть проект

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

Метод Описание
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.

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

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

Read ( InputNode node ) : Object

This method is used to read the key value from the node. The value read from the node is resolved using the template filter. If the key 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 key value from the node. The value read from the node is resolved using the template filter. If the key value can not be found according to the annotation attributes then an exception is thrown.

ReadAttribute ( InputNode node, String key ) : Object

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

ReadElement ( InputNode node, String key ) : Object

This method is used to read the key value from the node. The value read from the node is resolved using the template filter. If the key 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 key value from the node. The value read from the node is resolved using the template filter. If the key value can not be found according to the annotation attributes then the node is considered as null and is valid.

ValidateAttribute ( InputNode node, String key ) : bool

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

ValidateElement ( InputNode node, String key ) : bool

This method is used to read the key value from the node. The value read from the node is resolved using the template filter. If the key value can not be found according to the annotation attributes then the node is considered as null and 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.

WriteAttribute ( OutputNode node, Object item ) : void

This method is used to write the value to the specified node. This will write the item as an attribute to the provided node, the name of the attribute is taken from the annotation.

WriteElement ( OutputNode node, Object item ) : void

This method is used to write the value to the specified node. This will write the item as an element to the provided node, also this enables references to be used during serialization.

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

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

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 ///
Результат bool

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

Constructor for the PrimitiveKey object. This is used to create the key object which converts the map key to an instance of the key type. This can also resolve references.
public PrimitiveKey ( 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 ///
Результат SimpleFramework.Xml.Strategy

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

This method is used to read the key value from the node. The value read from the node is resolved using the template filter. If the key 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 key value from ///
Результат Object

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

This method is used to read the key value from the node. The value read from the node is resolved using the template filter. If the key 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 key value from ///
value Object /// this is the value to deserialize in to ///
Результат Object

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

This method is used to read the key value from the node. The value read from the node is resolved using the template filter. If the key value can not be found according to the annotation attributes then an null is assumed and returned.
public ReadAttribute ( InputNode node, String key ) : Object
node InputNode /// this is the node to read the key value from ///
key String /// this is the name of the attribute used by the key ///
Результат Object

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

This method is used to read the key value from the node. The value read from the node is resolved using the template filter. If the key value can not be found according to the annotation attributes then null is assumed and returned.
public ReadElement ( InputNode node, String key ) : Object
node InputNode /// this is the node to read the key value from ///
key String /// this is the name of the element used by the key ///
Результат Object

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

This method is used to read the key value from the node. The value read from the node is resolved using the template filter. If the key value can not be found according to the annotation attributes then the node is considered as null and is valid.
public Validate ( InputNode node ) : bool
node InputNode /// this is the node to read the key value from ///
Результат bool

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

This method is used to read the key value from the node. The value read from the node is resolved using the template filter. If the key value can not be found according to the annotation attributes then the node is considered as null and is valid.
public ValidateAttribute ( InputNode node, String key ) : bool
node InputNode /// this is the node to read the key value from ///
key String /// this is the name of the attribute used by the key ///
Результат bool

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

This method is used to read the key value from the node. The value read from the node is resolved using the template filter. If the key value can not be found according to the annotation attributes then the node is considered as null and is valid.
public ValidateElement ( InputNode node, String key ) : bool
node InputNode /// this is the node to read the key value from ///
key String /// this is the name of the element used by the key ///
Результат bool

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

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 ///
Результат void

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

This method is used to write the value to the specified node. This will write the item as an attribute to the provided node, the name of the attribute is taken from the annotation.
public WriteAttribute ( 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 ///
Результат void

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

This method is used to write the value to the specified node. This will write the item as an element to the provided node, also this enables references to be used during serialization.
public WriteElement ( 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 ///
Результат void