001/**
002 * Copyright 2011 The Kuali Foundation Licensed under the
003 * Educational Community License, Version 2.0 (the "License"); you may
004 * not use this file except in compliance with the License. You may
005 * obtain a copy of the License at
006 *
007 * http://www.osedu.org/licenses/ECL-2.0
008 *
009 * Unless required by applicable law or agreed to in writing,
010 * software distributed under the License is distributed on an "AS IS"
011 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
012 * or implied. See the License for the specific language governing
013 * permissions and limitations under the License.
014 */
015package org.kuali.mobility.push.service.rest.pojo;
016
017import javax.xml.bind.annotation.*;
018import java.util.HashMap;
019import java.util.Map;
020
021/**
022 * @author Kuali Mobility Team (mobility.collab@kuali.org)
023 */
024@XmlRootElement
025@XmlAccessorType(XmlAccessType.FIELD)
026@XmlSeeAlso(HashMap.class)
027public class MapResponse<T, E> extends ServiceObject {
028
029        @XmlElementWrapper(name="map")
030        @XmlElement(name = "entry")
031        private HashMap<T, E> data;
032
033        public MapResponse(Map<T, E> data){
034                if(data instanceof HashMap){
035                        this.data = (HashMap)data;
036                }
037                else{
038                        this.data = new HashMap<T, E>(data);
039                }
040        }
041
042        public MapResponse(){
043                this.data = null;
044        }
045
046        public HashMap<T, E> getMap(){
047                return this.data;
048        }
049
050        public void setMap(HashMap<T, E> data){
051                this.data = data;
052        }
053}