logging-log4net-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ni...@apache.org
Subject cvs commit: logging-log4net/src/Util/TypeConverters BooleanConverter.cs ConversionNotSupportedException.cs ConverterRegistry.cs EncodingConverter.cs IConvertFrom.cs IConvertTo.cs PatternLayoutConverter.cs PatternStringConverter.cs TypeConverter.cs TypeConverterAttribute.cs
Date Mon, 20 Dec 2004 00:44:46 GMT
nicko       2004/12/19 16:44:46

  Modified:    src/Util/TypeConverters BooleanConverter.cs
                        ConversionNotSupportedException.cs
                        ConverterRegistry.cs EncodingConverter.cs
                        IConvertFrom.cs IConvertTo.cs
                        PatternLayoutConverter.cs PatternStringConverter.cs
                        TypeConverter.cs TypeConverterAttribute.cs
  Log:
  Updated doc comments.
  
  Revision  Changes    Path
  1.5       +24 -2     logging-log4net/src/Util/TypeConverters/BooleanConverter.cs
  
  Index: BooleanConverter.cs
  ===================================================================
  RCS file: /home/cvs/logging-log4net/src/Util/TypeConverters/BooleanConverter.cs,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- BooleanConverter.cs	19 Dec 2004 19:24:35 -0000	1.4
  +++ BooleanConverter.cs	20 Dec 2004 00:44:45 -0000	1.5
  @@ -24,8 +24,13 @@
   	/// Type converter for Boolean.
   	/// </summary>
   	/// <remarks>
  -	/// Supports conversion from string to boolean type.
  +	/// <para>
  +	/// Supports conversion from string to <c>bool</c> type.
  +	/// </para>
   	/// </remarks>
  +	/// <seealso cref="ConverterRegistry"/>
  +	/// <seealso cref="IConvertFrom"/>
  +	/// <seealso cref="IConvertTo"/>
   	/// <author>Nicko Cadell</author>
   	/// <author>Gert Driesen</author>
   	public class BooleanConverter : IConvertFrom
  @@ -37,9 +42,15 @@
   		/// </summary>
   		/// <param name="sourceType">the type to convert</param>
   		/// <returns>true if the conversion is possible</returns>
  +		/// <remarks>
  +		/// <para>
  +		/// Returns <c>true</c> if the <paramref name="sourceType"/> is
  +		/// the <see cref="String"/> type.
  +		/// </para>
  +		/// </remarks>
   		public bool CanConvertFrom(Type sourceType)
   		{
  -			return sourceType == typeof(string);
  +			return (sourceType == typeof(string));
   		}
   
   		/// <summary>
  @@ -47,6 +58,17 @@
   		/// </summary>
   		/// <param name="source">the object to convert</param>
   		/// <returns>the converted object</returns>
  +		/// <remarks>
  +		/// <para>
  +		/// Uses the <see cref="Boolean.Parse"/> method to convert the
  +		/// <see cref="String"/> argument to a <see cref="Boolean"/>.
  +		/// </para>
  +		/// </remarks>
  + 		/// <exception cref="ConversionNotSupportedException">
  + 		/// The <paramref name="source"/> object cannot be converted to the
  + 		/// target type. To check for this condition use the <see cref="CanConvertFrom"/>
  + 		/// method.
  + 		/// </exception>
   		public object ConvertFrom(object source)
   		{
   			string str = source as string;
  
  
  
  1.3       +32 -8     logging-log4net/src/Util/TypeConverters/ConversionNotSupportedException.cs
  
  Index: ConversionNotSupportedException.cs
  ===================================================================
  RCS file: /home/cvs/logging-log4net/src/Util/TypeConverters/ConversionNotSupportedException.cs,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ConversionNotSupportedException.cs	16 Feb 2004 02:10:55 -0000	1.2
  +++ ConversionNotSupportedException.cs	20 Dec 2004 00:44:45 -0000	1.3
  @@ -41,28 +41,42 @@
   		#region Public Instance Constructors
   
   		/// <summary>
  -		/// Initializes a new instance of the <see cref="ConversionNotSupportedException"
/> class.
  +		/// Constructor
   		/// </summary>
  +		/// <remarks>
  +		/// <para>
  +		/// Initializes a new instance of the <see cref="ConversionNotSupportedException"
/> class.
  +		/// </para>
  +		/// </remarks>
   		public ConversionNotSupportedException()
   		{
   		}
   
   		/// <summary>
  -		/// Initializes a new instance of the <see cref="ConversionNotSupportedException"
/> class
  -		/// with the specified message.
  +		/// Constructor
   		/// </summary>
   		/// <param name="message">A message to include with the exception.</param>
  +		/// <remarks>
  +		/// <para>
  +		/// Initializes a new instance of the <see cref="ConversionNotSupportedException"
/> class
  +		/// with the specified message.
  +		/// </para>
  +		/// </remarks>
   		public ConversionNotSupportedException(String message) : base(message) 
   		{
   		}
  -
   		
   		/// <summary>
  -		/// Initializes a new instance of the <see cref="ConversionNotSupportedException"
/> class
  -		/// with the specified message and inner exception.
  +		/// Constructor
   		/// </summary>
   		/// <param name="message">A message to include with the exception.</param>
   		/// <param name="innerException">A nested exception to include.</param>
  +		/// <remarks>
  +		/// <para>
  +		/// Initializes a new instance of the <see cref="ConversionNotSupportedException"
/> class
  +		/// with the specified message and inner exception.
  +		/// </para>
  +		/// </remarks>
   		public ConversionNotSupportedException(String message, Exception innerException) : base(message,
innerException) 
   		{
   		}
  @@ -73,11 +87,16 @@
   
   #if !NETCF
   		/// <summary>
  -		/// Initializes a new instance of the <see cref="ConversionNotSupportedException"
/> class 
  -		/// with serialized data.
  +		/// Serialization constructor
   		/// </summary>
   		/// <param name="info">The <see cref="SerializationInfo" /> that holds the
serialized object data about the exception being thrown.</param>
   		/// <param name="context">The <see cref="StreamingContext" /> that contains
contextual information about the source or destination.</param>
  +		/// <remarks>
  +		/// <para>
  +		/// Initializes a new instance of the <see cref="ConversionNotSupportedException"
/> class 
  +		/// with serialized data.
  +		/// </para>
  +		/// </remarks>
   		protected ConversionNotSupportedException(SerializationInfo info, StreamingContext context)
: base(info, context) 
   		{
   		}
  @@ -93,6 +112,11 @@
   		/// <param name="destinationType">The conversion destination type.</param>
   		/// <param name="sourceValue">The value to convert.</param>
   		/// <returns>An instance of the <see cref="ConversionNotSupportedException"
/>.</returns>
  +		/// <remarks>
  +		/// <para>
  +		/// Creates a new instance of the <see cref="ConversionNotSupportedException" />
class.
  +		/// </para>
  +		/// </remarks>
   		public static ConversionNotSupportedException Create(Type destinationType, object sourceValue)
   		{
   			if (sourceValue == null)
  
  
  
  1.8       +97 -48    logging-log4net/src/Util/TypeConverters/ConverterRegistry.cs
  
  Index: ConverterRegistry.cs
  ===================================================================
  RCS file: /home/cvs/logging-log4net/src/Util/TypeConverters/ConverterRegistry.cs,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ConverterRegistry.cs	19 Dec 2004 19:24:41 -0000	1.7
  +++ ConverterRegistry.cs	20 Dec 2004 00:44:45 -0000	1.8
  @@ -26,22 +26,36 @@
   	/// <summary>
   	/// Register of type converters for specific types.
   	/// </summary>
  +	/// <remarks>
  +	/// <para>
  +	/// Maintains a registry of type converters used to convert between
  +	/// types.
  +	/// </para>
  +	/// <para>
  +	/// Use the <see cref="AddConverter"/> methods to register new converters.
  +	/// The <see cref="GetConvertTo"/> and <see cref="GetConvertFrom"/> methods
  +	/// lookup appropriate converters to use.
  +	/// </para>
  +	/// </remarks>
  +	/// <seealso cref="IConvertFrom"/>
  +	/// <seealso cref="IConvertTo"/>
   	/// <author>Nicko Cadell</author>
   	/// <author>Gert Driesen</author>
   	public sealed class ConverterRegistry
   	{
  -		#region Internal Instance Constructors
  +		#region Private Constructors
   
   		/// <summary>
  -		/// Initializes a new instance of the <see cref="ConverterRegistry" /> class.
  +		/// Private constructor
   		/// </summary>
  +		/// <remarks>
  +		/// Initializes a new instance of the <see cref="ConverterRegistry" /> class.
  +		/// </remarks>
   		private ConverterRegistry() 
   		{
  -			// Initialize the type2converter hashtable
  -			m_type2converter = new Hashtable();
   		}
   
  -		#endregion Internal Instance Constructors
  +		#endregion Private Constructors
   
   		#region Static Constructor
   
  @@ -49,13 +63,12 @@
   		/// Static constructor.
   		/// </summary>
   		/// <remarks>
  -		/// This constructor defines the intrinsic type converters
  +		/// <para>
  +		/// This constructor defines the intrinsic type converters.
  +		/// </para>
   		/// </remarks>
   		static ConverterRegistry()
   		{
  -			// Create the registry
  -			s_registry = new ConverterRegistry();
  -
   			// Add predefined converters here
   			AddConverter(typeof(bool), typeof(BooleanConverter));
   			AddConverter(typeof(System.Text.Encoding), typeof(EncodingConverter));
  @@ -73,11 +86,19 @@
   		/// </summary>
   		/// <param name="destinationType">The type being converted to.</param>
   		/// <param name="converter">The type converter to use to convert to the destination
type.</param>
  +		/// <remarks>
  +		/// <para>
  +		/// Adds a converter instance for a specific type.
  +		/// </para>
  +		/// </remarks>
   		public static void AddConverter(Type destinationType, object converter)
   		{
   			if (destinationType != null && converter != null)
   			{
  -				s_registry.m_type2converter[destinationType] = converter;
  +				lock(s_type2converter)
  +				{
  +					s_type2converter[destinationType] = converter;
  +				}
   			}
   		}
   
  @@ -86,6 +107,11 @@
   		/// </summary>
   		/// <param name="destinationType">The type being converted to.</param>
   		/// <param name="converterType">The type of the type converter to use to convert
to the destination type.</param>
  +		/// <remarks>
  +		/// <para>
  +		/// Adds a converter <see cref="Type"/> for a specific type.
  +		/// </para>
  +		/// </remarks>
   		public static void AddConverter(Type destinationType, Type converterType)
   		{
   			AddConverter(destinationType, CreateConverterInstance(converterType));
  @@ -100,6 +126,11 @@
   		/// The type converter instance to use for type conversions or <c>null</c>

   		/// if no type converter is found.
   		/// </returns>
  +		/// <remarks>
  +		/// <para>
  +		/// Gets the type converter to use to convert values to the destination type.
  +		/// </para>
  +		/// </remarks>
   		public static IConvertTo GetConvertTo(Type sourceType, Type destinationType)
   		{
   			// TODO: Support inheriting type converters.
  @@ -107,22 +138,25 @@
   
   			// TODO: Is destinationType required? We don't use it for anything.
   
  -			// Lookup in the static registry
  -			IConvertTo converter = s_registry.m_type2converter[sourceType] as IConvertTo;
  -
  -			if (converter == null)
  +			lock(s_type2converter)
   			{
  -				// Lookup using attributes
  -				converter = GetConverterFromAttribute(sourceType) as IConvertTo;
  +				// Lookup in the static registry
  +				IConvertTo converter = s_type2converter[sourceType] as IConvertTo;
   
  -				if (converter != null)
  +				if (converter == null)
   				{
  -					// Store in registry
  -					s_registry.m_type2converter[sourceType] = converter;
  +					// Lookup using attributes
  +					converter = GetConverterFromAttribute(sourceType) as IConvertTo;
  +
  +					if (converter != null)
  +					{
  +						// Store in registry
  +						s_type2converter[sourceType] = converter;
  +					}
   				}
  -			}
   
  -			return converter;
  +				return converter;
  +			}
   		}
   
   		/// <summary>
  @@ -133,27 +167,35 @@
   		/// The type converter instance to use for type conversions or <c>null</c>

   		/// if no type converter is found.
   		/// </returns>
  +		/// <remarks>
  +		/// <para>
  +		/// Gets the type converter to use to convert values to the destination type.
  +		/// </para>
  +		/// </remarks>
   		public static IConvertFrom GetConvertFrom(Type destinationType)
   		{
   			// TODO: Support inheriting type converters.
   			// i.e. getting a type converter for a base of destinationType
   
  -			// Lookup in the static registry
  -			IConvertFrom converter = s_registry.m_type2converter[destinationType] as IConvertFrom;
  -
  -			if (converter == null)
  +			lock(s_type2converter)
   			{
  -				// Lookup using attributes
  -				converter = GetConverterFromAttribute(destinationType) as IConvertFrom;
  +				// Lookup in the static registry
  +				IConvertFrom converter = s_type2converter[destinationType] as IConvertFrom;
   
  -				if (converter != null)
  +				if (converter == null)
   				{
  -					// Store in registry
  -					s_registry.m_type2converter[destinationType] = converter;
  +					// Lookup using attributes
  +					converter = GetConverterFromAttribute(destinationType) as IConvertFrom;
  +
  +					if (converter != null)
  +					{
  +						// Store in registry
  +						s_type2converter[destinationType] = converter;
  +					}
   				}
  -			}
   
  -			return converter;
  +				return converter;
  +			}
   		}
   		
   		/// <summary>
  @@ -187,24 +229,40 @@
   		/// Creates the instance of the type converter.
   		/// </summary>
   		/// <param name="converterType">The type of the type converter.</param>
  +		/// <returns>
  +		/// The type converter instance to use for type conversions or <c>null</c>

  +		/// if no type converter is found.
  +		/// </returns>
   		/// <remarks>
  +		/// <para>
   		/// The type specified for the type converter must implement 
   		/// the <see cref="IConvertFrom"/> or <see cref="IConvertTo"/> interfaces

   		/// and must have a public default (no argument) constructor.
  +		/// </para>
   		/// </remarks>
  -		/// <returns>
  -		/// The type converter instance to use for type conversions or <c>null</c>

  -		/// if no type converter is found.</returns>
   		private static object CreateConverterInstance(Type converterType)
   		{
  -			if (converterType != null)
  +			if (converterType == null)
   			{
  -				// Check type is a converter
  -				if (typeof(IConvertFrom).IsAssignableFrom(converterType) || typeof(IConvertTo).IsAssignableFrom(converterType))
  +				throw new ArgumentNullException("converterType", "CreateConverterInstance cannot create
instance, converterType is null");
  +			}
  +
  +			// Check type is a converter
  +			if (typeof(IConvertFrom).IsAssignableFrom(converterType) || typeof(IConvertTo).IsAssignableFrom(converterType))
  +			{
  +				try
   				{
   					// Create the type converter
   					return Activator.CreateInstance(converterType);
   				}
  +				catch(Exception ex)
  +				{
  +					LogLog.Error("ConverterRegistry: Cannot CreateConverterInstance of type ["+converterType.FullName+"],
Exception in call to Activator.CreateInstance", ex);
  +				}
  +			}
  +			else
  +			{
  +				LogLog.Error("ConverterRegistry: Cannot CreateConverterInstance of type ["+converterType.FullName+"],
type does not implement IConvertFrom or IConvertTo");
   			}
   			return null;
   		}
  @@ -214,18 +272,9 @@
   		#region Private Static Fields
   
   		/// <summary>
  -		/// The singleton registry.
  -		/// </summary>
  -		private static ConverterRegistry s_registry;
  -
  -		#endregion
  -
  -		#region Private Instance Fields
  -
  -		/// <summary>
   		/// Mapping from <see cref="Type" /> to type converter.
   		/// </summary>
  -		private Hashtable m_type2converter;
  +		private static Hashtable s_type2converter = new Hashtable();
   
   		#endregion
   	}
  
  
  
  1.4       +29 -8     logging-log4net/src/Util/TypeConverters/EncodingConverter.cs
  
  Index: EncodingConverter.cs
  ===================================================================
  RCS file: /home/cvs/logging-log4net/src/Util/TypeConverters/EncodingConverter.cs,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- EncodingConverter.cs	19 Dec 2004 19:24:47 -0000	1.3
  +++ EncodingConverter.cs	20 Dec 2004 00:44:45 -0000	1.4
  @@ -22,9 +22,16 @@
   namespace log4net.Util.TypeConverters
   {
   	/// <summary>
  -	/// Implementation of <see cref="IConvertFrom"/> that converts an <see cref="Encoding"/>
  -	/// instance from a string.
  +	/// Supports conversion from string to <see cref="Encoding"/> type.
   	/// </summary>
  +	/// <remarks>
  +	/// <para>
  +	/// Supports conversion from string to <see cref="Encoding"/> type.
  +	/// </para>
  +	/// </remarks>
  +	/// <seealso cref="ConverterRegistry"/>
  +	/// <seealso cref="IConvertFrom"/>
  +	/// <seealso cref="IConvertTo"/>
   	/// <author>Nicko Cadell</author>
   	/// <author>Gert Driesen</author>
   	public class EncodingConverter : IConvertFrom 
  @@ -32,13 +39,16 @@
   		#region Implementation of IConvertFrom
   
   		/// <summary>
  -		/// Overrides the CanConvertFrom method of IConvertFrom.
  -		/// The ITypeDescriptorContext interface provides the context for the
  -		/// conversion. Typically this interface is used at design time to 
  -		/// provide information about the design-time container.
  +		/// Can the source type be converted to the type supported by this object
   		/// </summary>
  -		/// <param name="sourceType"></param>
  -		/// <returns>true if the source is a string</returns>
  +		/// <param name="sourceType">the type to convert</param>
  +		/// <returns>true if the conversion is possible</returns>
  +		/// <remarks>
  +		/// <para>
  +		/// Returns <c>true</c> if the <paramref name="sourceType"/> is
  +		/// the <see cref="String"/> type.
  +		/// </para>
  +		/// </remarks>
   		public bool CanConvertFrom(Type sourceType) 
   		{
   			return (sourceType == typeof(string));
  @@ -49,6 +59,17 @@
   		/// </summary>
   		/// <param name="source">the object to convert to an encoding</param>
   		/// <returns>the encoding</returns>
  +		/// <remarks>
  +		/// <para>
  +		/// Uses the <see cref="Encoding.GetEncoding"/> method to convert the
  +		/// <see cref="String"/> argument to an <see cref="Encoding"/>.
  +		/// </para>
  +		/// </remarks>
  +		/// <exception cref="ConversionNotSupportedException">
  +		/// The <paramref name="source"/> object cannot be converted to the
  +		/// target type. To check for this condition use the <see cref="CanConvertFrom"/>
  +		/// method.
  +		/// </exception>
   		public object ConvertFrom(object source) 
   		{
   			string str = source as string;
  
  
  
  1.4       +14 -0     logging-log4net/src/Util/TypeConverters/IConvertFrom.cs
  
  Index: IConvertFrom.cs
  ===================================================================
  RCS file: /home/cvs/logging-log4net/src/Util/TypeConverters/IConvertFrom.cs,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- IConvertFrom.cs	23 Feb 2004 03:18:05 -0000	1.3
  +++ IConvertFrom.cs	20 Dec 2004 00:44:45 -0000	1.4
  @@ -24,8 +24,10 @@
   	/// Interface supported by type converters
   	/// </summary>
   	/// <remarks>
  +	/// <para>
   	/// This interface supports conversion from arbitrary types
   	/// to a single target type. See <see cref="TypeConverterAttribute"/>.
  +	/// </para>
   	/// </remarks>
   	/// <author>Nicko Cadell</author>
   	/// <author>Gert Driesen</author>
  @@ -36,6 +38,12 @@
   		/// </summary>
   		/// <param name="sourceType">the type to convert</param>
   		/// <returns>true if the conversion is possible</returns>
  +		/// <remarks>
  +		/// <para>
  +		/// Test if the <paramref name="sourceType"/> can be converted to the
  +		/// type supported by this converter.
  +		/// </para>
  +		/// </remarks>
   		bool CanConvertFrom(Type sourceType);
   
   		/// <summary>
  @@ -43,6 +51,12 @@
   		/// </summary>
   		/// <param name="source">the object to convert</param>
   		/// <returns>the converted object</returns>
  +		/// <remarks>
  +		/// <para>
  +		/// Converts the <paramref name="source"/> to the type supported
  +		/// by this converter.
  +		/// </para>
  +		/// </remarks>
   		object ConvertFrom(object source);
   	}
   }
  
  
  
  1.4       +14 -0     logging-log4net/src/Util/TypeConverters/IConvertTo.cs
  
  Index: IConvertTo.cs
  ===================================================================
  RCS file: /home/cvs/logging-log4net/src/Util/TypeConverters/IConvertTo.cs,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- IConvertTo.cs	23 Feb 2004 03:18:05 -0000	1.3
  +++ IConvertTo.cs	20 Dec 2004 00:44:45 -0000	1.4
  @@ -24,8 +24,10 @@
   	/// Interface supported by type converters
   	/// </summary>
   	/// <remarks>
  +	/// <para>
   	/// This interface supports conversion from a single type to arbitrary types.
   	/// See <see cref="TypeConverterAttribute"/>.
  +	/// </para>
   	/// </remarks>
   	/// <author>Nicko Cadell</author>
   	public interface IConvertTo
  @@ -35,6 +37,12 @@
   		/// </summary>
   		/// <param name="targetType">A Type that represents the type you want to convert
to</param>
   		/// <returns>true if the conversion is possible</returns>
  +		/// <remarks>
  +		/// <para>
  +		/// Test if the type supported by this converter can be converted to the
  +		/// <paramref name="targetType"/>.
  +		/// </para>
  +		/// </remarks>
   		bool CanConvertTo(Type targetType);
   
   		/// <summary>
  @@ -43,6 +51,12 @@
   		/// <param name="source">the object to convert</param>
   		/// <param name="targetType">The Type to convert the value parameter to</param>
   		/// <returns>the converted object</returns>
  +		/// <remarks>
  +		/// <para>
  +		/// Converts the <paramref name="source"/> (which must be of the type supported
  +		/// by this converter) to the <paramref name="targetType"/> specified..
  +		/// </para>
  +		/// </remarks>
   		object ConvertTo(object source, Type targetType);
   	}
   }
  
  
  
  1.3       +34 -8     logging-log4net/src/Util/TypeConverters/PatternLayoutConverter.cs
  
  Index: PatternLayoutConverter.cs
  ===================================================================
  RCS file: /home/cvs/logging-log4net/src/Util/TypeConverters/PatternLayoutConverter.cs,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PatternLayoutConverter.cs	19 Dec 2004 19:24:52 -0000	1.2
  +++ PatternLayoutConverter.cs	20 Dec 2004 00:44:45 -0000	1.3
  @@ -24,22 +24,36 @@
   namespace log4net.Util.TypeConverters
   {
   	/// <summary>
  -	/// Implementation of <see cref="IConvertFrom"/> that converts 
  -	/// a string into a <see cref="PatternLayout"/>.
  +	/// Supports conversion from string to <see cref="PatternLayout"/> type.
   	/// </summary>
  +	/// <remarks>
  +	/// <para>
  +	/// Supports conversion from string to <see cref="PatternLayout"/> type.
  +	/// </para>
  +	/// <para>
  +	/// The string is used as the <see cref="PatternLayout.ConversionPattern"/> 
  +	/// of the <see cref="PatternLayout"/>.
  +	/// </para>
  +	/// </remarks>
  +	/// <seealso cref="ConverterRegistry"/>
  +	/// <seealso cref="IConvertFrom"/>
  +	/// <seealso cref="IConvertTo"/>
   	/// <author>Nicko Cadell</author>
   	public class PatternLayoutConverter : IConvertFrom
   	{
   		#region Implementation of IConvertFrom
   
   		/// <summary>
  -		/// Overrides the CanConvertFrom method of IConvertFrom.
  -		/// The ITypeDescriptorContext interface provides the context for the
  -		/// conversion. Typically this interface is used at design time to 
  -		/// provide information about the design-time container.
  +		/// Can the source type be converted to the type supported by this object
   		/// </summary>
  -		/// <param name="sourceType"></param>
  -		/// <returns>true if the source is a string</returns>
  +		/// <param name="sourceType">the type to convert</param>
  +		/// <returns>true if the conversion is possible</returns>
  +		/// <remarks>
  +		/// <para>
  +		/// Returns <c>true</c> if the <paramref name="sourceType"/> is
  +		/// the <see cref="String"/> type.
  +		/// </para>
  +		/// </remarks>
   		public bool CanConvertFrom(System.Type sourceType)
   		{
   			return (sourceType == typeof(string));
  @@ -50,6 +64,18 @@
   		/// </summary>
   		/// <param name="source">the object to convert to a PatternLayout</param>
   		/// <returns>the PatternLayout</returns>
  +		/// <remarks>
  +		/// <para>
  +		/// Creates and returns a new <see cref="PatternLayout"/> using
  +		/// the <paramref name="source"/> <see cref="String"/> as the
  +		/// <see cref="PatternLayout.ConversionPattern"/>.
  +		/// </para>
  +		/// </remarks>
  +		/// <exception cref="ConversionNotSupportedException">
  +		/// The <paramref name="source"/> object cannot be converted to the
  +		/// target type. To check for this condition use the <see cref="CanConvertFrom"/>
  +		/// method.
  +		/// </exception>
   		public object ConvertFrom(object source) 
   		{
   			string str = source as string;
  
  
  
  1.5       +54 -11    logging-log4net/src/Util/TypeConverters/PatternStringConverter.cs
  
  Index: PatternStringConverter.cs
  ===================================================================
  RCS file: /home/cvs/logging-log4net/src/Util/TypeConverters/PatternStringConverter.cs,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PatternStringConverter.cs	19 Dec 2004 19:24:58 -0000	1.4
  +++ PatternStringConverter.cs	20 Dec 2004 00:44:45 -0000	1.5
  @@ -24,20 +24,37 @@
   namespace log4net.Util.TypeConverters
   {
   	/// <summary>
  -	/// Implementation of <see cref="IConvertFrom"/> that converts 
  -	/// a <see cref="PatternString"/> to a string and a string into
  -	/// a <see cref="PatternString"/>.
  +	/// Convert between string and <see cref="PatternString"/>
   	/// </summary>
  +	/// <remarks>
  +	/// <para>
  +	/// Supports conversion from string to <see cref="PatternString"/> type, 
  +	/// and from a <see cref="PatternString"/> type to a string.
  +	/// </para>
  +	/// <para>
  +	/// The string is used as the <see cref="PatternString.ConversionPattern"/> 
  +	/// of the <see cref="PatternString"/>.
  +	/// </para>
  +	/// </remarks>
  +	/// <seealso cref="ConverterRegistry"/>
  +	/// <seealso cref="IConvertFrom"/>
  +	/// <seealso cref="IConvertTo"/>
   	/// <author>Nicko Cadell</author>
   	public class PatternStringConverter : IConvertTo, IConvertFrom
   	{
   		#region Implementation of IConvertTo
   
   		/// <summary>
  -		/// Returns whether this converter can convert the object to the specified type
  +		/// Can the target type be converted to the type supported by this object
   		/// </summary>
  -		/// <param name="targetType">A Type that represents the type you want to convert
to</param>
  +		/// <param name="targetType">A <see cref="Type"/> that represents the type
you want to convert to</param>
   		/// <returns>true if the conversion is possible</returns>
  +		/// <remarks>
  +		/// <para>
  +		/// Returns <c>true</c> if the <paramref name="targetType"/> is
  +		/// assignable from a <see cref="String"/> type.
  +		/// </para>
  +		/// </remarks>
   		public bool CanConvertTo(Type targetType)
   		{
   			return (typeof(string).IsAssignableFrom(targetType));
  @@ -49,6 +66,17 @@
   		/// <param name="source">the object to convert</param>
   		/// <param name="targetType">The Type to convert the value parameter to</param>
   		/// <returns>the converted object</returns>
  +		/// <remarks>
  +		/// <para>
  +		/// Uses the <see cref="PatternString.Format"/> method to convert the
  +		/// <see cref="PatternString"/> argument to a <see cref="String"/>.
  +		/// </para>
  +		/// </remarks>
  +		/// <exception cref="ConversionNotSupportedException">
  +		/// The <paramref name="source"/> object cannot be converted to the
  +		/// <paramref name="targetType"/>. To check for this condition use the 
  +		/// <see cref="CanConvertTo"/> method.
  +		/// </exception>
   		public object ConvertTo(object source, Type targetType)
   		{
   			PatternString patternString = source as PatternString;
  @@ -64,13 +92,16 @@
   		#region Implementation of IConvertFrom
   
   		/// <summary>
  -		/// Overrides the CanConvertFrom method of IConvertFrom.
  -		/// The ITypeDescriptorContext interface provides the context for the
  -		/// conversion. Typically this interface is used at design time to 
  -		/// provide information about the design-time container.
  +		/// Can the source type be converted to the type supported by this object
   		/// </summary>
  -		/// <param name="sourceType"></param>
  -		/// <returns>true if the source is a string</returns>
  +		/// <param name="sourceType">the type to convert</param>
  +		/// <returns>true if the conversion is possible</returns>
  +		/// <remarks>
  +		/// <para>
  +		/// Returns <c>true</c> if the <paramref name="sourceType"/> is
  +		/// the <see cref="String"/> type.
  +		/// </para>
  +		/// </remarks>
   		public bool CanConvertFrom(System.Type sourceType)
   		{
   			return (sourceType == typeof(string));
  @@ -81,6 +112,18 @@
   		/// </summary>
   		/// <param name="source">the object to convert to a PatternString</param>
   		/// <returns>the PatternString</returns>
  +		/// <remarks>
  +		/// <para>
  +		/// Creates and returns a new <see cref="PatternString"/> using
  +		/// the <paramref name="source"/> <see cref="String"/> as the
  +		/// <see cref="PatternString.ConversionPattern"/>.
  +		/// </para>
  +		/// </remarks>
  +		/// <exception cref="ConversionNotSupportedException">
  +		/// The <paramref name="source"/> object cannot be converted to the
  +		/// target type. To check for this condition use the <see cref="CanConvertFrom"/>
  +		/// method.
  +		/// </exception>
   		public object ConvertFrom(object source) 
   		{
   			string str = source as string;
  
  
  
  1.3       +31 -7     logging-log4net/src/Util/TypeConverters/TypeConverter.cs
  
  Index: TypeConverter.cs
  ===================================================================
  RCS file: /home/cvs/logging-log4net/src/Util/TypeConverters/TypeConverter.cs,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TypeConverter.cs	19 Dec 2004 19:25:04 -0000	1.2
  +++ TypeConverter.cs	20 Dec 2004 00:44:45 -0000	1.3
  @@ -22,21 +22,32 @@
   namespace log4net.Util.TypeConverters
   {
   	/// <summary>
  -	/// Implementation of <see cref="IConvertFrom"/> that converts to a <see cref="Type"/>
instance from a string.
  +	/// Supports conversion from string to <see cref="Type"/> type.
   	/// </summary>
  +	/// <remarks>
  +	/// <para>
  +	/// Supports conversion from string to <see cref="Type"/> type.
  +	/// </para>
  +	/// </remarks>
  +	/// <seealso cref="ConverterRegistry"/>
  +	/// <seealso cref="IConvertFrom"/>
  +	/// <seealso cref="IConvertTo"/>
   	/// <author>Nicko Cadell</author>
   	public class TypeConverter : IConvertFrom 
   	{
   		#region Implementation of IConvertFrom
   
   		/// <summary>
  -		/// Overrides the CanConvertFrom method of IConvertFrom.
  -		/// The ITypeDescriptorContext interface provides the context for the
  -		/// conversion. Typically this interface is used at design time to 
  -		/// provide information about the design-time container.
  +		/// Can the source type be converted to the type supported by this object
   		/// </summary>
  -		/// <param name="sourceType"></param>
  -		/// <returns>true if the source is a string</returns>
  +		/// <param name="sourceType">the type to convert</param>
  +		/// <returns>true if the conversion is possible</returns>
  +		/// <remarks>
  +		/// <para>
  +		/// Returns <c>true</c> if the <paramref name="sourceType"/> is
  +		/// the <see cref="String"/> type.
  +		/// </para>
  +		/// </remarks>
   		public bool CanConvertFrom(Type sourceType) 
   		{
   			return (sourceType == typeof(string));
  @@ -47,6 +58,19 @@
   		/// </summary>
   		/// <param name="source">the object to convert to a Type</param>
   		/// <returns>the Type</returns>
  +		/// <remarks>
  +		/// <para>
  +		/// Uses the <see cref="Type.GetType"/> method to convert the
  +		/// <see cref="String"/> argument to a <see cref="Type"/>.
  +		/// Additional effort is made to locate partially specified types
  +		/// by searching the loaded assemblies.
  +		/// </para>
  +		/// </remarks>
  +		/// <exception cref="ConversionNotSupportedException">
  +		/// The <paramref name="source"/> object cannot be converted to the
  +		/// target type. To check for this condition use the <see cref="CanConvertFrom"/>
  +		/// method.
  +		/// </exception>
   		public object ConvertFrom(object source) 
   		{
   			string str = source as string;
  
  
  
  1.4       +18 -2     logging-log4net/src/Util/TypeConverters/TypeConverterAttribute.cs
  
  Index: TypeConverterAttribute.cs
  ===================================================================
  RCS file: /home/cvs/logging-log4net/src/Util/TypeConverters/TypeConverterAttribute.cs,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TypeConverterAttribute.cs	23 Feb 2004 03:18:05 -0000	1.3
  +++ TypeConverterAttribute.cs	20 Dec 2004 00:44:45 -0000	1.4
  @@ -21,13 +21,18 @@
   namespace log4net.Util.TypeConverters
   {
   	/// <summary>
  -	/// Class and Interface level attribute that specifies a type converter
  -	/// to use with the associated type.
  +	/// Attribute used to associate a type converter
   	/// </summary>
   	/// <remarks>
  +	/// <para>
  +	/// Class and Interface level attribute that specifies a type converter
  +	/// to use with the associated type.
  +	/// </para>
  +	/// <para>
   	/// To associate a type converter with a target type apply a
   	/// <c>TypeConverterAttribute</c> to the target type. Specify the
   	/// type of the type converter on the attribute.
  +	/// </para>
   	/// </remarks>
   	/// <author>Nicko Cadell</author>
   	/// <author>Gert Driesen</author>
  @@ -48,6 +53,11 @@
   		/// <summary>
   		/// Default constructor
   		/// </summary>
  +		/// <remarks>
  +		/// <para>
  +		/// Default constructor
  +		/// </para>
  +		/// </remarks>
   		public TypeConverterAttribute()
   		{
   		}
  @@ -57,8 +67,10 @@
   		/// </summary>
   		/// <param name="typeName">The string type name of the type converter</param>
   		/// <remarks>
  +		/// <para>
   		/// The type specified must implement the <see cref="IConvertFrom"/> 
   		/// or the <see cref="IConvertTo"/> interfaces.
  +		/// </para>
   		/// </remarks>
   		public TypeConverterAttribute(string typeName)
   		{
  @@ -70,8 +82,10 @@
   		/// </summary>
   		/// <param name="converterType">The type of the type converter</param>
   		/// <remarks>
  +		/// <para>
   		/// The type specified must implement the <see cref="IConvertFrom"/> 
   		/// or the <see cref="IConvertTo"/> interfaces.
  +		/// </para>
   		/// </remarks>
   		public TypeConverterAttribute(Type converterType)
   		{
  @@ -87,8 +101,10 @@
   		/// The string type name of the type converter 
   		/// </value>
   		/// <remarks>
  +		/// <para>
   		/// The type specified must implement the <see cref="IConvertFrom"/> 
   		/// or the <see cref="IConvertTo"/> interfaces.
  +		/// </para>
   		/// </remarks>
   		public string ConverterTypeName
   		{
  
  
  

Mime
View raw message