List of usage examples for org.apache.commons.collections.map CompositeMap CompositeMap
public CompositeMap(Map[] composite, MapMutator mutator)
From source file:mondrian.calc.CalcWriter.java
public void visitCalc(Calc calc, String name, Map<String, Object> arguments, Calc[] childCalcs) { writer.print(getLinePrefix());/*from w ww.j a va 2s . c o m*/ writer.print(name); final Map<String, Object> parentArgs = parentArgMap.get(calc); if (parentArgs != null && !parentArgs.isEmpty()) { //noinspection unchecked arguments = new CompositeMap(arguments, parentArgs); } if (!arguments.isEmpty()) { writer.print("("); int k = 0; for (Map.Entry<String, Object> entry : arguments.entrySet()) { if (k++ > 0) { writer.print(", "); } writer.print(entry.getKey()); writer.print("="); writer.print(entry.getValue()); } writer.print(")"); } writer.println(); int k = 0; for (Calc childCalc : childCalcs) { visitChild(k++, childCalc); } }
From source file:org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsControllerHelper.java
public ModelAndView handleActionResponse(GroovyObject controller, Object returnValue, String closurePropertyName, String viewName) { boolean viewNameBlank = (viewName == null || viewName.length() == 0); // reset the metaclass ModelAndView explicityModelAndView = (ModelAndView) controller .getProperty(ControllerDynamicMethods.MODEL_AND_VIEW_PROPERTY); if (!webRequest.isRenderView()) { return null; } else if (explicityModelAndView != null) { return explicityModelAndView; } else if (returnValue == null) { if (viewNameBlank) { return null; } else {/*from w w w. j ava 2 s . com*/ Map model; if (!this.chainModel.isEmpty()) { model = new CompositeMap(this.chainModel, new BeanMap(controller)); } else { model = new BeanMap(controller); } return new ModelAndView(viewName, model); } } else if (returnValue instanceof Map) { // remove any Proxy wrappers and set the adaptee as the value Map finalModel = new LinkedHashMap(); if (!this.chainModel.isEmpty()) { finalModel.putAll(this.chainModel); } Map returnModel = (Map) returnValue; finalModel.putAll(returnModel); removeProxiesFromModelObjects(finalModel); return new ModelAndView(viewName, finalModel); } else if (returnValue instanceof ModelAndView) { ModelAndView modelAndView = (ModelAndView) returnValue; // remove any Proxy wrappers and set the adaptee as the value Map modelMap = modelAndView.getModel(); removeProxiesFromModelObjects(modelMap); if (!this.chainModel.isEmpty()) { modelAndView.addAllObjects(this.chainModel); } if (modelAndView.getView() == null && modelAndView.getViewName() == null) { if (viewNameBlank) { throw new NoViewNameDefinedException( "ModelAndView instance returned by and no view name defined by nor for closure on property [" + closurePropertyName + "] in controller [" + controller.getClass() + "]!"); } else { modelAndView.setViewName(viewName); } } return modelAndView; } else { Map model; if (!this.chainModel.isEmpty()) { model = new CompositeMap(this.chainModel, new BeanMap(controller)); } else { model = new BeanMap(controller); } return new ModelAndView(viewName, model); } }