C# Class SimpleFramework.Xml.Core.Support

The Support object is used to provide support to the serialization engine for processing and transforming strings. This contains a Transformer which will create objects from strings and will also reverse this process converting an object to a string. This is used in the conversion of primitive types.
Inheritance: Filter
Mostrar archivo Open project: ngallagher/simplexml Class Usage Examples

Public Methods

Method Description
GetClassName ( Class type ) : String

This returns the name of the class specified. If there is a root annotation on the type, then this is ignored in favor of the actual class name. This is typically used when the type is a primitive or if there is no Root annotation present.

GetInstance ( Class type ) : Instance

This will create an Instance that can be used to instantiate objects of the specified class. This leverages an internal constructor cache to ensure creation is quicker.

GetInstance ( Value value ) : Instance

This will create an Instance that can be used to instantiate objects of the specified class. This leverages an internal constructor cache to ensure creation is quicker.

GetName ( Class type ) : String

This is used to acquire the name of the specified type using the Root annotation for the class. This will use either the name explicitly provided by the annotation or it will use the name of the class that the annotation was placed on if there is no explicit name for the root.

GetScanner ( Class type ) : Scanner

This creates a Scanner object that can be used to examine the fields within the XML class schema. The scanner maintains information when a field from within the scanner is visited, this allows the serialization and deserialization process to determine if all required XML annotations are used.

GetTransform ( Class type ) : Transform

This is used to match a Transform using the type specified. If no transform can be acquired then this returns a null value indicating that no transform could be found.

IsFloat ( Class type ) : bool

This is used to determine if the type specified is a floating point type. Types that are floating point are the double and float primitives as well as the java types for this primitives.

IsPrimitive ( Class type ) : bool

This is used to determine whether the scanned class represents a primitive type. A primitive type is a type that contains no XML annotations and so cannot be serialized with an XML form. Instead primitives a serialized using transformations.

Read ( String value, Class type ) : Object

This method is used to convert the string value given to an appropriate representation. This is used when an object is being deserialized from the XML document and the value for the string representation is required.

Replace ( String text ) : String

Replaces the text provided with some property. This method acts much like a the get method of the Map object, in that it uses the provided text as a key to some value. However it can also be used to evaluate expressions and output the result for inclusion in the generated XML.

Support ( ) : SimpleFramework.Xml.Filter

Constructor for the Support object. This will create a support object with a default matcher and default platform filter. This ensures it contains enough information to process a template and transform basic primitive types.

Support ( Filter filter ) : SimpleFramework.Xml.Filter

Constructor for the Support object. This will create a support object with a default matcher and the filter provided. This ensures it contains enough information to process a template and transform basic primitive types.

Support ( Filter filter, Matcher matcher ) : SimpleFramework.Xml.Filter

Constructor for the Support object. This will create a support object with the matcher and filter provided. This allows the user to override the transformations that are used to convert types to strings and back again.

Valid ( Class type ) : bool

This method is used to determine if the type specified can be transformed. This will use the Matcher to find a suitable transform, if one exists then this returns true, if not then this returns false. This is used during serialization to determine how to convert a field or method parameter.

Write ( Object value, Class type ) : String

This method is used to convert the provided value into an XML usable format. This is used in the serialization process when there is a need to convert a field value in to a string so that that value can be written as a valid XML entity.

Method Details

GetClassName() public method

This returns the name of the class specified. If there is a root annotation on the type, then this is ignored in favor of the actual class name. This is typically used when the type is a primitive or if there is no Root annotation present.
public GetClassName ( Class type ) : String
type Class /// this is the type to acquire the root name for ///
return String

GetInstance() public method

This will create an Instance that can be used to instantiate objects of the specified class. This leverages an internal constructor cache to ensure creation is quicker.
public GetInstance ( Class type ) : Instance
type Class /// this is the type that is to be instantiated ///
return Instance

GetInstance() public method

This will create an Instance that can be used to instantiate objects of the specified class. This leverages an internal constructor cache to ensure creation is quicker.
public GetInstance ( Value value ) : Instance
value Value /// this contains information on the object instance ///
return Instance

GetName() public method

This is used to acquire the name of the specified type using the Root annotation for the class. This will use either the name explicitly provided by the annotation or it will use the name of the class that the annotation was placed on if there is no explicit name for the root.
public GetName ( Class type ) : String
type Class /// this is the type to acquire the root name for ///
return String

GetScanner() public method

This creates a Scanner object that can be used to examine the fields within the XML class schema. The scanner maintains information when a field from within the scanner is visited, this allows the serialization and deserialization process to determine if all required XML annotations are used.
public GetScanner ( Class type ) : Scanner
type Class /// the schema class the scanner is created for ///
return Scanner

GetTransform() public method

This is used to match a Transform using the type specified. If no transform can be acquired then this returns a null value indicating that no transform could be found.
public GetTransform ( Class type ) : Transform
type Class /// this is the type to acquire the transform for ///
return Transform

IsFloat() public method

This is used to determine if the type specified is a floating point type. Types that are floating point are the double and float primitives as well as the java types for this primitives.
public IsFloat ( Class type ) : bool
type Class /// this is the type to determine if it is a float ///
return bool

IsPrimitive() public method

This is used to determine whether the scanned class represents a primitive type. A primitive type is a type that contains no XML annotations and so cannot be serialized with an XML form. Instead primitives a serialized using transformations.
public IsPrimitive ( Class type ) : bool
type Class /// this is the type to determine if it is primitive ///
return bool

Read() public method

This method is used to convert the string value given to an appropriate representation. This is used when an object is being deserialized from the XML document and the value for the string representation is required.
public Read ( String value, Class type ) : Object
value String /// this is the string representation of the value ///
type Class /// this is the type to convert the string value to ///
return Object

Replace() public method

Replaces the text provided with some property. This method acts much like a the get method of the Map object, in that it uses the provided text as a key to some value. However it can also be used to evaluate expressions and output the result for inclusion in the generated XML.
public Replace ( String text ) : String
text String /// this is the text value that is to be replaced ///
return String

Support() public method

Constructor for the Support object. This will create a support object with a default matcher and default platform filter. This ensures it contains enough information to process a template and transform basic primitive types.
public Support ( ) : SimpleFramework.Xml.Filter
return SimpleFramework.Xml.Filter

Support() public method

Constructor for the Support object. This will create a support object with a default matcher and the filter provided. This ensures it contains enough information to process a template and transform basic primitive types.
public Support ( Filter filter ) : SimpleFramework.Xml.Filter
filter Filter /// this is the filter to use with this support ///
return SimpleFramework.Xml.Filter

Support() public method

Constructor for the Support object. This will create a support object with the matcher and filter provided. This allows the user to override the transformations that are used to convert types to strings and back again.
public Support ( Filter filter, Matcher matcher ) : SimpleFramework.Xml.Filter
filter Filter /// this is the filter to use with this support ///
matcher Matcher /// this is the matcher used for transformations ///
return SimpleFramework.Xml.Filter

Valid() public method

This method is used to determine if the type specified can be transformed. This will use the Matcher to find a suitable transform, if one exists then this returns true, if not then this returns false. This is used during serialization to determine how to convert a field or method parameter.
public Valid ( Class type ) : bool
type Class /// the type to determine whether its transformable ///
return bool

Write() public method

This method is used to convert the provided value into an XML usable format. This is used in the serialization process when there is a need to convert a field value in to a string so that that value can be written as a valid XML entity.
public Write ( Object value, Class type ) : String
value Object /// this is the value to be converted to a string ///
type Class /// this is the type to convert to a string value ///
return String