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 /// Base implementation of <see cref="ITypeConverter"/>
24 public abstract class AbstractTypeConverter
: ITypeConverter
26 private ITypeConverterContext context
;
28 public ITypeConverterContext Context
30 get { return context; }
31 set { context = value; }
35 /// Returns true if this instance of <c>ITypeConverter</c>
36 /// is able to handle the specified type with the specified
39 /// <param name="type"></param>
40 /// <param name="configuration"></param>
41 /// <returns></returns>
43 /// The default behavior is to just pass it to the normal CanHadnleType
44 /// peeking into the configuration is used for some advanced functionality
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
);