Files
mono/mcs/class/System.XML/System.Xml.Serialization/ReflectionHelper.cs
T
Lluis Sanchez 8e18d03529 * SoapReflectionImporter.cs: implemented.
* TypeTranslator.cs: added IsPrimitive() method
	* TypeMapping.cs: Added RelatedMaps property that returns all maps directly or indirectly
	  used by that one. Also added Format property, that can be literal or encoded.
	* XmlReflectionImporter.cs: little fixes. Moved some methods to ReflectionHelper.
	* XmlReflectionMember.cs: added constructor that accepts SoapAttributes
	* XmlSerializationReader.cs: implemented many methods needed to support encoded format.
	* XmlSerializationReaderInterpreter.cs: added support for encoded format.
	* XmlSerializationWriter.cs: added support for encoded format.
	* XmlSerializationWriterInterpreter.cs: added support for encoded format.
	* XmlTypeMapElementInfo.cs: added some properties needed to support encoded format
	* XmlTypeMapMemberAttribute.cs: added MappedType property (enum values can be attributes,
	  and a map is needed for them).
	* XmlTypeMapMemberElement.cs: small fixes.
	* XmlTypeMapping.cs: added some properties and methods needed to support encoded format
	* ReflectionHelper.cs: added. Has some methods shared by the reflection importers.

svn path=/trunk/mcs/; revision=15130
2003-06-05 18:17:28 +00:00

54 lines
1.4 KiB
C#

//
// System.Xml.Serialization.ReflectionHelper
//
// Author:
// Lluis Sanchez Gual ([email protected])
//
// Copyright (C) 2003 Ximian, Inc.
//
using System.Reflection;
using System.Collections;
namespace System.Xml.Serialization
{
internal class ReflectionHelper
{
Hashtable _clrTypes = new Hashtable ();
Hashtable _schemaTypes = new Hashtable ();
public void RegisterSchemaType (XmlTypeMapping map, string xmlType, string ns)
{
string mapKey = xmlType + "/" + ns;
if (!_schemaTypes.ContainsKey (xmlType))
_schemaTypes.Add (mapKey, map);
}
public XmlTypeMapping GetRegisteredSchemaType (string xmlType, string ns)
{
string mapKey = xmlType + "/" + ns;
return _schemaTypes[mapKey] as XmlTypeMapping;
}
public void RegisterClrType (XmlTypeMapping map, Type type, string ns)
{
if (type == typeof(object)) ns = "";
string mapKey = type.FullName + "/" + ns;
if (!_clrTypes.ContainsKey (mapKey))
_clrTypes.Add (mapKey, map);
}
public XmlTypeMapping GetRegisteredClrType (Type type, string ns)
{
if (type == typeof(object)) ns = "";
string mapKey = type.FullName + "/" + ns;
return _clrTypes[mapKey] as XmlTypeMapping;
}
public Exception CreateError (XmlTypeMapping map, string message)
{
return new InvalidOperationException ("There was an error reflecting '" + map.TypeFullName + "': " + message);
}
}
}