1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
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
7 // http://www.apache.org/licenses/LICENSE-2.0
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
18 using Castle
.Core
.Configuration
;
21 /// Implements a conversion logic to a type of a
24 public interface ITypeConverter
26 ITypeConverterContext Context { get; set; }
29 /// Returns true if this instance of <c>ITypeConverter</c>
30 /// is able to handle the specified type.
32 /// <param name="type"></param>
33 /// <returns></returns>
34 bool CanHandleType(Type type
);
37 /// Returns true if this instance of <c>ITypeConverter</c>
38 /// is able to handle the specified type with the specified
41 /// <param name="type"></param>
42 /// <param name="configuration"></param>
43 /// <returns></returns>
44 bool CanHandleType(Type type
, IConfiguration configuration
);
47 /// Should perform the conversion from the
48 /// string representation specified to the type
51 /// <param name="value"></param>
52 /// <param name="targetType"></param>
53 /// <returns></returns>
54 object PerformConversion(String
value, Type targetType
);
57 /// Should perform the conversion from the
58 /// configuration node specified to the type
61 /// <param name="configuration"></param>
62 /// <param name="targetType"></param>
63 /// <returns></returns>
64 object PerformConversion(IConfiguration configuration
, Type targetType
);