001/* 002 * Copyright 2002-2015 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.ui; 018 019import java.util.Collection; 020import java.util.Map; 021 022/** 023 * Subclass of {@link ModelMap} that implements the {@link Model} interface. 024 * Java 5 specific like the {@code Model} interface itself. 025 * 026 * <p>This is an implementation class exposed to handler methods by Spring MVC, typically via 027 * a declaration of the {@link org.springframework.ui.Model} interface. There is no need to 028 * build it within user code; a plain {@link org.springframework.ui.ModelMap} or even a just 029 * a regular {@link Map} with String keys will be good enough to return a user model. 030 * 031 * @author Juergen Hoeller 032 * @since 2.5.1 033 */ 034@SuppressWarnings("serial") 035public class ExtendedModelMap extends ModelMap implements Model { 036 037 @Override 038 public ExtendedModelMap addAttribute(String attributeName, Object attributeValue) { 039 super.addAttribute(attributeName, attributeValue); 040 return this; 041 } 042 043 @Override 044 public ExtendedModelMap addAttribute(Object attributeValue) { 045 super.addAttribute(attributeValue); 046 return this; 047 } 048 049 @Override 050 public ExtendedModelMap addAllAttributes(Collection<?> attributeValues) { 051 super.addAllAttributes(attributeValues); 052 return this; 053 } 054 055 @Override 056 public ExtendedModelMap addAllAttributes(Map<String, ?> attributes) { 057 super.addAllAttributes(attributes); 058 return this; 059 } 060 061 @Override 062 public ExtendedModelMap mergeAttributes(Map<String, ?> attributes) { 063 super.mergeAttributes(attributes); 064 return this; 065 } 066 067 @Override 068 public Map<String, Object> asMap() { 069 return this; 070 } 071 072}