1 // Copyright 2004-2007 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
.Routing
18 using System
.Collections
.Generic
;
23 public class RouteMatch
25 private readonly Type controllerType
;
26 private readonly string ruleName
;
27 private readonly string action
;
28 private readonly List
<string> literals
= new List
<string>();
29 private readonly Dictionary
<string, string> parameters
= new Dictionary
<string, string>();
32 /// Initializes a new instance of the <see cref="RouteMatch"/> class.
34 /// <param name="controllerType">Type of the controller.</param>
35 /// <param name="ruleName">Name of the rule.</param>
36 /// <param name="action">The action.</param>
37 public RouteMatch(Type controllerType
, string ruleName
, string action
)
39 this.controllerType
= controllerType
;
40 this.ruleName
= ruleName
;
45 /// Gets the type of the controller.
47 /// <value>The type of the controller.</value>
48 public Type ControllerType
50 get { return controllerType; }
54 /// Gets the name of the rule.
56 /// <value>The name of the rule.</value>
57 public string RuleName
59 get { return ruleName; }
65 /// <value>The action.</value>
68 get { return action; }
72 /// Gets the literals.
74 /// <value>The literals.</value>
75 public List
<string> Literals
77 get { return literals; }
81 /// Gets the parameters.
83 /// <value>The parameters.</value>
84 public Dictionary
<string, string> Parameters
86 get { return parameters; }
90 /// Adds the specified literal.
92 /// <param name="literal">The literal.</param>
93 public void Add(string literal
)
95 literals
.Add(literal
);
101 /// <param name="name">The name.</param>
102 /// <param name="value">The value.</param>
103 public void AddNamed(string name
, string value)
105 parameters
[name
] = value;