| |||||||||||||||||
Source File | Conditionals | Statements | Methods | TOTAL | |||||||||||||
Utilities\TypesResolver\CachedTypeResolver.cs | 100.0 % | 100.0 % | 100.0 % | 100.0 % |
|
1 | ||
2 | #region Apache Notice | |
3 | /***************************************************************************** | |
4 | * $Header: $ | |
5 | * $Revision: $ | |
6 | * $Date: $ | |
7 | * | |
8 | * Copyright 2004 the original author or authors. | |
9 | * | |
10 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
11 | * you may not use this file except in compliance with the License. | |
12 | * You may obtain a copy of the License at | |
13 | * | |
14 | * http://www.apache.org/licenses/LICENSE-2.0 | |
15 | * | |
16 | * Unless required by applicable law or agreed to in writing, software | |
17 | * distributed under the License is distributed on an "AS IS" BASIS, | |
18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
19 | * See the License for the specific language governing permissions and | |
20 | * limitations under the License. | |
21 | * | |
22 | ********************************************************************************/ | |
23 | #endregion | |
24 | ||
25 | #region Remarks | |
26 | // Code from Spring.NET | |
27 | #endregion | |
28 | ||
29 | #region Imports | |
30 | ||
31 | using System; | |
32 | using System.Collections; | |
33 | using System.Collections.Specialized; | |
34 | ||
35 | #endregion | |
36 | ||
37 | namespace IBatisNet.Common.Utilities.TypesResolver | |
38 | { | |
39 | /// <summary> | |
40 | /// Summary description for CachedTypeResolver. | |
41 | /// </summary> | |
42 | public class CachedTypeResolver: TypeResolver | |
43 | { | |
44 | #region Constructor (s) / Destructor | |
45 | /// <summary> | |
46 | /// Creates a new instance of the CachedTypeResolver class. | |
47 | /// </summary> | |
48 | 1361 | public CachedTypeResolver () {} |
49 | #endregion | |
50 | ||
51 | #region Properties | |
52 | /// <summary> | |
53 | /// The cache, mapping type names against a <see cref="System.Type"/> | |
54 | /// instance. | |
55 | /// </summary> | |
56 | private IDictionary TypeCache | |
57 | { | |
58 | 24347 | get |
59 | { | |
60 | 24347 | return typeCache; |
61 | } | |
62 | } | |
63 | #endregion | |
64 | ||
65 | #region Methods | |
66 | /// <summary> | |
67 | /// Resolves the supplied type name into a <see cref="System.Type"/> | |
68 | /// instance. | |
69 | /// </summary> | |
70 | /// <param name="typeName"> | |
71 | /// The (possibly partially assembly qualified) name of a <see cref="System.Type"/>. | |
72 | /// </param> | |
73 | /// <returns> | |
74 | /// A resolved <see cref="System.Type"/> instance. | |
75 | /// </returns> | |
76 | /// <exception cref="System.TypeLoadException"> | |
77 | /// If the type could not be resolved. | |
78 | /// </exception> | |
79 | 24310 | public override Type Resolve (string typeName) |
80 | { | |
81 | 24310 | Type type = TypeCache [typeName] as Type; |
82 | 24310 | if (type == null) |
83 | { | |
84 | 37 | type = base.Resolve (typeName); |
85 | 37 | TypeCache [typeName] = type; |
86 | } | |
87 | 24310 | return type; |
88 | } | |
89 | #endregion | |
90 | ||
91 | #region Fields | |
92 | private IDictionary typeCache = new HybridDictionary (); | |
93 | #endregion | |
94 | } | |
95 | } | |
96 |
|