C# Класс SimpleFramework.Xml.Util.RegistryStrategy

The RegistryStrategy object is used to intercept the serialization process and delegate to custom converters. The custom converters are resolved from a Registry object, which is provided to the constructor. If there is no binding for a particular object then serialization is delegated to an internal strategy. All converters resolved by this are instantiated once and cached internally for performance.

By default the TreeStrategy is used to perform the normal serialization process should there be no class binding specifying a converter to use. However, any implementation can be used, including the CycleStrategy, which handles cycles in the object graph. To specify the internal strategy to use it can be provided in the constructor.

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

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

Метод Описание
IsReference ( Value value ) : bool

This is used to determine if the Value provided represents a reference. If it does represent a reference then this will return true, if it does not then this returns false.

Lookup ( Type type, Object value ) : Converter

This is used to acquire a Converter instance for the provided object instance. The instance class is used to resolve the converter to use for the serialization process.

Lookup ( Type type, Value value ) : Converter

This is used to acquire a Converter instance for the provided value object. The value object is used to resolve the converter to use for the serialization process.

Read ( Type type, NodeMap node, SimpleFramework.Xml.Util.Dictionary map ) : Value

This is used to read the Value which will be used to represent the deserialized object. If there is an binding present then the value will contain an object instance. If it does not then it is up to the internal strategy to determine what the returned value contains.

Read ( Type type, NodeMap node, Value value ) : Value

This is used to read the Value which will be used to represent the deserialized object. If there is an binding present then the value will contain an object instance. If it does not then it is up to the internal strategy to determine what the returned value contains.

RegistryStrategy ( Registry registry ) : SimpleFramework.Xml.Strategy

Constructor for the RegistryStrategy object. This is used to create a strategy that will intercept the normal serialization process by searching for bindings within the provided Registry instance.

RegistryStrategy ( Registry registry, Strategy strategy ) : SimpleFramework.Xml.Strategy

Constructor for the RegistryStrategy object. This is used to create a strategy that will intercept the normal serialization process by searching for bindings within the provided Registry instance.

Write ( Type type, Object value, NodeMap node ) : bool

This is used to serialize a representation of the object value provided. If there is a Registry binding present for the provided type then this will use the converter specified to serialize a representation of the object. If however there is no binding present then this will delegate to the internal strategy. This returns true if the serialization has completed.

Write ( Type type, Object value, NodeMap node, SimpleFramework.Xml.Util.Dictionary map ) : bool

This is used to serialize a representation of the object value provided. If there is a Registry binding present for the provided type then this will use the converter specified to serialize a representation of the object. If however there is no binding present then this will delegate to the internal strategy. This returns true if the serialization has completed.

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

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

This is used to determine if the Value provided represents a reference. If it does represent a reference then this will return true, if it does not then this returns false.
public IsReference ( Value value ) : bool
value Value /// this is the value instance to be evaluated ///
Результат bool

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

This is used to acquire a Converter instance for the provided object instance. The instance class is used to resolve the converter to use for the serialization process.
public Lookup ( Type type, Object value ) : Converter
type Type /// this is the type representing the field or method ///
value Object /// this is the value that is to be serialized ///
Результат Converter

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

This is used to acquire a Converter instance for the provided value object. The value object is used to resolve the converter to use for the serialization process.
public Lookup ( Type type, Value value ) : Converter
type Type /// this is the type representing the field or method ///
value Value /// this is the value that is to be serialized ///
Результат Converter

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

This is used to read the Value which will be used to represent the deserialized object. If there is an binding present then the value will contain an object instance. If it does not then it is up to the internal strategy to determine what the returned value contains.
public Read ( Type type, NodeMap node, SimpleFramework.Xml.Util.Dictionary map ) : Value
type Type /// this is the type that represents a method or field ///
node NodeMap /// this is the node representing the XML element ///
map SimpleFramework.Xml.Util.Dictionary /// this is the session map that contain variables ///
Результат Value

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

This is used to read the Value which will be used to represent the deserialized object. If there is an binding present then the value will contain an object instance. If it does not then it is up to the internal strategy to determine what the returned value contains.
public Read ( Type type, NodeMap node, Value value ) : Value
type Type /// this is the type that represents a method or field ///
node NodeMap /// this is the node representing the XML element ///
value Value /// this is the value from the internal strategy ///
Результат Value

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

Constructor for the RegistryStrategy object. This is used to create a strategy that will intercept the normal serialization process by searching for bindings within the provided Registry instance.
public RegistryStrategy ( Registry registry ) : SimpleFramework.Xml.Strategy
registry Registry /// this is the registry instance with bindings ///
Результат SimpleFramework.Xml.Strategy

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

Constructor for the RegistryStrategy object. This is used to create a strategy that will intercept the normal serialization process by searching for bindings within the provided Registry instance.
public RegistryStrategy ( Registry registry, Strategy strategy ) : SimpleFramework.Xml.Strategy
registry Registry /// this is the registry instance with bindings ///
strategy Strategy /// this is the strategy to delegate to ///
Результат SimpleFramework.Xml.Strategy

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

This is used to serialize a representation of the object value provided. If there is a Registry binding present for the provided type then this will use the converter specified to serialize a representation of the object. If however there is no binding present then this will delegate to the internal strategy. This returns true if the serialization has completed.
public Write ( Type type, Object value, NodeMap node ) : bool
type Type /// this is the type that represents the field or method ///
value Object /// this is the object instance to be serialized ///
node NodeMap /// this is the XML element to be serialized to ///
Результат bool

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

This is used to serialize a representation of the object value provided. If there is a Registry binding present for the provided type then this will use the converter specified to serialize a representation of the object. If however there is no binding present then this will delegate to the internal strategy. This returns true if the serialization has completed.
public Write ( Type type, Object value, NodeMap node, SimpleFramework.Xml.Util.Dictionary map ) : bool
type Type /// this is the type that represents the field or method ///
value Object /// this is the object instance to be serialized ///
node NodeMap /// this is the XML element to be serialized to ///
map SimpleFramework.Xml.Util.Dictionary /// this is the session map used by the serializer ///
Результат bool