2010-06-21 Marek Habersack <mhabersack@novell.com>
[mcs.git] / class / System.Web.Mvc / System.Web.Mvc / ReflectedParameterDescriptor.cs
blob7eec02fb5fcf9710c517dfb6a9aedc9535c55d5e
1 /* ****************************************************************************
3 * Copyright (c) Microsoft Corporation. All rights reserved.
5 * This software is subject to the Microsoft Public License (Ms-PL).
6 * A copy of the license can be found in the license.htm file included
7 * in this distribution.
9 * You must not remove this notice, or any other, from this software.
11 * ***************************************************************************/
13 namespace System.Web.Mvc {
14 using System;
15 using System.Reflection;
17 public class ReflectedParameterDescriptor : ParameterDescriptor {
19 private readonly ActionDescriptor _actionDescriptor;
20 private readonly ReflectedParameterBindingInfo _bindingInfo;
22 public ReflectedParameterDescriptor(ParameterInfo parameterInfo, ActionDescriptor actionDescriptor) {
23 if (parameterInfo == null) {
24 throw new ArgumentNullException("parameterInfo");
26 if (actionDescriptor == null) {
27 throw new ArgumentNullException("actionDescriptor");
30 ParameterInfo = parameterInfo;
31 _actionDescriptor = actionDescriptor;
32 _bindingInfo = new ReflectedParameterBindingInfo(parameterInfo);
35 public override ActionDescriptor ActionDescriptor {
36 get {
37 return _actionDescriptor;
41 public override ParameterBindingInfo BindingInfo {
42 get {
43 return _bindingInfo;
47 public ParameterInfo ParameterInfo {
48 get;
49 private set;
52 public override string ParameterName {
53 get {
54 return ParameterInfo.Name;
58 public override Type ParameterType {
59 get {
60 return ParameterInfo.ParameterType;
64 public override object[] GetCustomAttributes(bool inherit) {
65 return ParameterInfo.GetCustomAttributes(inherit);
68 public override object[] GetCustomAttributes(Type attributeType, bool inherit) {
69 return ParameterInfo.GetCustomAttributes(attributeType, inherit);
72 public override bool IsDefined(Type attributeType, bool inherit) {
73 return ParameterInfo.IsDefined(attributeType, inherit);