GRAILS-1019: Allowing expressions to be used with the 'disabled' attribute for g...
[grails.git] / src / groovy / org / codehaus / groovy / grails / web / converters / AbstractParsingParameterCreationListener.groovy
blobcf875a13bab6f953713f9cd49abe1acaa8b6791c
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.converters
17 import org.codehaus.groovy.grails.web.servlet.mvc.ParameterCreationListener
19 /**
20 * Abstract base class for parameter creation listeners that parse incoming data such as JSON and XML
22 * @author Graeme Rocher
23 * @since 1.0
25 * Created: Nov 27, 2007
27 abstract class AbstractParsingParameterCreationListener implements ParameterCreationListener {
29 /**
30 * Populates the target map with current map using the root map to form a nested prefix so that a hierarchy of maps is flattened
32 protected createFlattenedKeys(Map root, Map current, Map target, prefix ='') {
34 for(entry in current) {
35 if(entry.value instanceof Map) {
36 createFlattenedKeys(root,entry.value, target, "${entry.key}.")
38 else if(prefix) {
39 target["${prefix}${entry.key}"] = entry.value