Removed untyped contructor from ComponentRegistration and add a protected setter.
[castle.git] / InversionOfControl / Castle.MicroKernel / SubSystems / Conversion / AbstractTypeConverter.cs
blobb8e8845783cec3aeb9a6c1de573e3e3a07f2bc6d
1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.MicroKernel.SubSystems.Conversion
17 using System;
18 using Castle.Core.Configuration;
20 /// <summary>
21 /// Base implementation of <see cref="ITypeConverter"/>
22 /// </summary>
23 [Serializable]
24 public abstract class AbstractTypeConverter : ITypeConverter
26 private ITypeConverterContext context;
28 public ITypeConverterContext Context
30 get { return context; }
31 set { context = value; }
34 /// <summary>
35 /// Returns true if this instance of <c>ITypeConverter</c>
36 /// is able to handle the specified type with the specified
37 /// configuration
38 /// </summary>
39 /// <param name="type"></param>
40 /// <param name="configuration"></param>
41 /// <returns></returns>
42 /// <remarks>
43 /// The default behavior is to just pass it to the normal CanHadnleType
44 /// peeking into the configuration is used for some advanced functionality
45 /// </remarks>
46 public virtual bool CanHandleType(Type type, IConfiguration configuration)
48 return CanHandleType(type);
51 public abstract bool CanHandleType(Type type);
53 public abstract object PerformConversion(String value, Type targetType);
55 public abstract object PerformConversion(IConfiguration configuration, Type targetType);