private static void BuildMethod(JsonRpcMethodBuilder builder, MethodInfo method)
        {
            Debug.Assert(method != null);
            Debug.Assert(builder != null);

            builder.InternalName = method.Name;
            builder.ResultType = method.ReturnType;
            builder.Dispatcher = new Dispatcher(method);
            
            //
            // Build via attributes.
            //
            
            object[] attributes = method.GetCustomAttributes(typeof(Attribute), true);
            foreach (Attribute attribute in attributes)
            {
                IMethodReflector reflector = attribute as IMethodReflector;
                
                if (reflector != null)
                    reflector.Build(builder, method);
                else 
                    builder.AddCustomAttribute(attribute);
            }
            
            //
            // Fault in the method name if still without name.
            //
            
            if (builder.Name.Length == 0)
                builder.Name = method.Name;

            //
            // Build the method parameters.
            //

            foreach (ParameterInfo parameter in method.GetParameters())
                BuildParameter(builder.DefineParameter(), parameter);
        }
 public void Build(JsonRpcMethodBuilder builder, MethodInfo method)
 {
     builder.AddCustomAttribute(this);
 }
 void IMethodReflector.Build(JsonRpcMethodBuilder builder, MethodInfo method)
 {
     builder.AddCustomAttribute(this);
 }