/// <summary> /// Ctor. /// </summary> internal JsonMethodDescription(MethodInfo method) { //TODO: clean up JsonMethodDescription efficiency if (method == null) { return; } if (!JsonMethodAttribute.IsJsonMethod(method)) { throw new InvalidMethodException("Specified method is not marked as a JsonMethod."); } this.Name = JsonMethodAttribute.GetJsonName(method); if (String.IsNullOrEmpty(this.Name)) { this.name = method.Name; } ParameterInfo[] parameters = method.GetParameters(); this.Params = new JsonNamedParameterDescription[parameters.Length]; for (int i = 0; i < parameters.Length; i++) { this.Params[i] = new JsonNamedParameterDescription(parameters[i]); } this.Return = new JsonParameterDescription(method.ReturnParameter); this.Help = JsonMethodAttribute.GetHelpUrl(method); this.Idempotent = JsonMethodAttribute.IsIdempotent(method); if (Attribute.IsDefined(method, typeof(DescriptionAttribute))) { DescriptionAttribute description = Attribute.GetCustomAttribute(method, typeof(DescriptionAttribute), true) as DescriptionAttribute; this.Summary = description.Description; } }