~ubuntu-branches/ubuntu/trusty/mono-addins/trusty-proposed

« back to all changes in this revision

Viewing changes to Mono.Addins/Mono.Addins/InstanceExtensionNode.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2011-04-25 11:11:33 UTC
  • mfrom: (4.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20110425111133-t05u5p7o5fxx70fu
Tags: 0.6-2
Upload to Unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
 
32
32
namespace Mono.Addins
33
33
{
 
34
        /// <summary>
 
35
        /// Base class for extension nodes which create extension objects
 
36
        /// </summary>
34
37
        public abstract class InstanceExtensionNode: ExtensionNode
35
38
        {
36
39
                object cachedInstance;
37
40
                
 
41
                /// <summary>
 
42
                /// Gets the extension object declared by this node
 
43
                /// </summary>
 
44
                /// <param name="expectedType">
 
45
                /// Expected object type. An exception will be thrown if the object is not an instance of the specified type.
 
46
                /// </param>
 
47
                /// <returns>
 
48
                /// The extension object
 
49
                /// </returns>
 
50
                /// <remarks>
 
51
                /// The extension object is cached and the same instance will be returned at every call.
 
52
                /// </remarks>
38
53
                public object GetInstance (Type expectedType)
39
54
                {
40
55
                        object ob = GetInstance ();
43
58
                        return ob;
44
59
                }
45
60
                
 
61
                /// <summary>
 
62
                /// Gets the extension object declared by this node
 
63
                /// </summary>
 
64
                /// <returns>
 
65
                /// The extension object
 
66
                /// </returns>
 
67
                /// <remarks>
 
68
                /// The extension object is cached and the same instance will be returned at every call.
 
69
                /// </remarks>
46
70
                public object GetInstance ()
47
71
                {
48
72
                        if (cachedInstance == null)
49
73
                                cachedInstance = CreateInstance ();
50
74
                        return cachedInstance;
51
75
                }
52
 
                
 
76
 
 
77
                /// <summary>
 
78
                /// Creates a new extension object
 
79
                /// </summary>
 
80
                /// <param name="expectedType">
 
81
                /// Expected object type. An exception will be thrown if the object is not an instance of the specified type.
 
82
                /// </param>
 
83
                /// <returns>
 
84
                /// The extension object
 
85
                /// </returns>
53
86
                public object CreateInstance (Type expectedType)
54
87
                {
55
88
                        object ob = CreateInstance ();
58
91
                        return ob;
59
92
                }
60
93
                
 
94
                /// <summary>
 
95
                /// Creates a new extension object
 
96
                /// </summary>
 
97
                /// <returns>
 
98
                /// The extension object
 
99
                /// </returns>
61
100
                public abstract object CreateInstance ();
62
101
        }
63
102
}