Removed untyped contructor from ComponentRegistration and add a protected setter.
[castle.git] / InversionOfControl / Castle.MicroKernel / SubSystems / Conversion / ITypeConverter.cs
blob718206041a95a42b3693916e72a960949b994196
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 /// Implements a conversion logic to a type of a
22 /// set of types.
23 /// </summary>
24 public interface ITypeConverter
26 ITypeConverterContext Context { get; set; }
28 /// <summary>
29 /// Returns true if this instance of <c>ITypeConverter</c>
30 /// is able to handle the specified type.
31 /// </summary>
32 /// <param name="type"></param>
33 /// <returns></returns>
34 bool CanHandleType(Type type);
36 /// <summary>
37 /// Returns true if this instance of <c>ITypeConverter</c>
38 /// is able to handle the specified type with the specified
39 /// configuration
40 /// </summary>
41 /// <param name="type"></param>
42 /// <param name="configuration"></param>
43 /// <returns></returns>
44 bool CanHandleType(Type type, IConfiguration configuration);
46 /// <summary>
47 /// Should perform the conversion from the
48 /// string representation specified to the type
49 /// specified.
50 /// </summary>
51 /// <param name="value"></param>
52 /// <param name="targetType"></param>
53 /// <returns></returns>
54 object PerformConversion(String value, Type targetType);
56 /// <summary>
57 /// Should perform the conversion from the
58 /// configuration node specified to the type
59 /// specified.
60 /// </summary>
61 /// <param name="configuration"></param>
62 /// <param name="targetType"></param>
63 /// <returns></returns>
64 object PerformConversion(IConfiguration configuration, Type targetType);