1 /* Copyright 2004-2005 Graeme Rocher
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 package org
.codehaus
.groovy
.grails
.web
.mapping
;
17 import org
.codehaus
.groovy
.grails
.validation
.ConstrainedProperty
;
19 import java
.util
.Collections
;
23 * Abstract UrlMapping implementation that provides common basic functionality
25 * @author Graeme Rocher
28 * Created: May 30, 2007
31 public abstract class AbstractUrlMapping
implements UrlMapping
{
33 protected final ConstrainedProperty
[] constraints
;
34 protected Object controllerName
;
35 protected Object actionName
;
36 protected Object viewName
;
37 protected Map parameterValues
= Collections
.EMPTY_MAP
;
40 * Base constructor required to construct a UrlMapping instance
42 * @param controllerName The name of the controller
43 * @param actionName The name of the action
44 * @param constraints Any constraints that apply to the mapping
46 public AbstractUrlMapping(Object controllerName
, Object actionName
, Object viewName
,ConstrainedProperty
[] constraints
) {
47 this.controllerName
= controllerName
;
48 this.actionName
= actionName
;
49 this.constraints
= constraints
;
50 this.viewName
= viewName
;
54 protected AbstractUrlMapping(Object viewName
, ConstrainedProperty
[] constraints
) {
55 this.viewName
= viewName
;
56 this.constraints
= constraints
;
60 * @see UrlMapping#getConstraints()
63 public ConstrainedProperty
[] getConstraints() {
68 * @see UrlMapping#getControllerName()
70 public Object
getControllerName() {
71 return controllerName
;
74 * @see org.codehaus.groovy.grails.web.mapping.UrlMapping#getActionName()
76 public Object
getActionName() {
81 * @see org.codehaus.groovy.grails.web.mapping.UrlMapping#getViewName()
84 public Object
getViewName() {
88 public void setParameterValues(Map parameterValues
) {
89 this.parameterValues
= Collections
.unmodifiableMap(parameterValues
);