1 // Copyright 2004-2006 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
19 using Castle
.Model
.Configuration
;
22 /// Base implementation of <see cref="ITypeConverter"/>
25 public abstract class AbstractTypeConverter
: ITypeConverter
27 private ITypeConverterContext context
;
29 public ITypeConverterContext Context
31 get { return context; }
32 set { context = value; }
35 //The default behavior is to just pass it to the normal CanHadnleType
36 //peeking into the configuration is used for some advanced functionality
37 public virtual bool CanHandleType(Type type
, IConfiguration configuration
)
39 return CanHandleType(type
);
42 public abstract bool CanHandleType(Type type
);
44 public abstract object PerformConversion(String
value, Type targetType
);
46 public abstract object PerformConversion(IConfiguration configuration
, Type targetType
);