1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle
.MonoRail
.Framework
.Descriptors
18 using System
.Reflection
;
21 /// Represents a rescue configuration
23 public class RescueDescriptor
25 private readonly string viewName
;
26 private readonly Type exceptionType
;
27 private readonly Type rescueController
;
28 private readonly MethodInfo rescueMethod
;
31 /// Initializes a new instance of the <see cref="RescueDescriptor"/> class.
33 /// <param name="viewName">Name of the rescue view.</param>
34 /// <param name="exceptionType">Type of the exception it is associated with.</param>
35 public RescueDescriptor(string viewName
, Type exceptionType
)
37 this.viewName
= viewName
;
38 this.exceptionType
= exceptionType
;
42 /// Initializes a new instance of the <see cref="RescueDescriptor"/> class.
44 /// <param name="rescueController">Controller to handle the rescue</param>
45 /// <param name="rescueMethod">Method to handle the rescue</param>
46 /// <param name="exceptionType">Type of the exception it is associated with.</param>
47 public RescueDescriptor(Type rescueController
, MethodInfo rescueMethod
, Type exceptionType
)
49 this.rescueController
= rescueController
;
50 this.rescueMethod
= rescueMethod
;
51 this.exceptionType
= exceptionType
;
55 /// Gets the name of the rescue view.
57 /// <value>The name of the view.</value>
58 public string ViewName
60 get { return viewName; }
64 /// Gets the type of the exception this rescue is associated with.
66 /// <value>The type of the exception.</value>
67 public Type ExceptionType
69 get { return exceptionType; }
73 /// The controller to use for rescue
75 public Type RescueController
77 get { return rescueController; }
81 /// The method on the rescue controller to use
83 public MethodInfo RescueMethod
85 get { return rescueMethod; }