コード例 #1
0
		public virtual void ProcessModel(IKernel kernel, ComponentModel model)
		{
			if (model == null) throw new ArgumentNullException("model");

			if (model.Configuration == null || model.Implementation == null) return;

			IConfiguration methodsNode = model.Configuration.Children[ObtainNodeName()];

			if (methodsNode == null) return;

			EnsureHasReferenceToConverter(kernel);

			foreach(IConfiguration methodNode in methodsNode.Children)
			{
				String name = methodNode.Name;

				if ("method".Equals(name))
				{
					name = methodNode.Attributes["name"];
				}

				AssertNameIsNotNull(name, model);

				MethodMetaModel metaModel = new MethodMetaModel(methodNode);

				if (IsValidMeta(model, metaModel))
				{
					if (ShouldUseMetaModel)
					{
						// model.MethodMetaModels.Add( metaModel );
					}

					String signature = methodNode.Attributes["signature"];

					IList<MethodInfo> methods = GetMethods(model.Implementation, name, signature);

					if (methods.Count == 0)
					{
						String message = String.Format( "The class {0} has tried to expose configuration for " + 
							"a method named {1} which could not be found.", model.Implementation.FullName, name );

						throw new Exception(message);
					}

					ProcessMeta(model, methods, metaModel);

					if (ShouldUseMetaModel)
					{
						// RegisterMethodsForFastAccess(methods, signature, metaModel, model);
					}
				}
			}
		}
コード例 #2
0
		protected virtual bool IsValidMeta(ComponentModel model, MethodMetaModel metaModel)
		{
			return true;
		}
		/// <summary>
		/// Processes the meta information available on
		/// the component configuration. (overrides MethodMetaInspector.ProcessMeta)
		/// </summary>
		/// <param name="model">The model.</param>
		/// <param name="methods">The methods.</param>
		/// <param name="metaModel">The meta model.</param>
		protected override void ProcessMeta(ComponentModel model, IList<MethodInfo> methods, MethodMetaModel metaModel)
		{
			metaStore.CreateMetaFromConfig(model.Implementation, methods, metaModel.ConfigNode);
		}
コード例 #4
0
		protected virtual void ProcessMeta(ComponentModel model, IList<MethodInfo> methods, MethodMetaModel metaModel)
		{
		}
コード例 #5
0
		/// <summary>
		/// Adds the specified model.
		/// </summary>
		/// <param name="model">The model.</param>
		public void Add(MethodMetaModel model)
		{
			InnerList.Add(model);
		}