View Javadoc
1   /*
2    * Licensed under the GPL License. You may not use this file except in compliance with the License.
3    * You may obtain a copy of the License at
4    *
5    *   https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
6    *
7    * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
8    * WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
9    * PURPOSE.
10   */
11  package psiprobe.model;
12  
13  import java.util.HashMap;
14  import java.util.Map;
15  
16  /**
17   * A wrapper class to assist marshalling of ModelAndView.getModel() map to XML representation.
18   */
19  public class TransportableModel {
20  
21    /** The items. */
22    private Map<String, Object> items = new HashMap<>();
23  
24    /**
25     * Gets the items.
26     *
27     * @return the items
28     */
29    public Map<String, Object> getItems() {
30      return items == null ? new HashMap<>() : new HashMap<>(items);
31    }
32  
33    /**
34     * Sets the items.
35     *
36     * @param items the items
37     */
38    public void setItems(Map<String, Object> items) {
39      this.items = items == null ? new HashMap<>() : new HashMap<>(items);
40    }
41  
42    /**
43     * Put all.
44     *
45     * @param map the map
46     */
47    public void putAll(Map<String, Object> map) {
48      if (map != null) {
49        items.putAll(new HashMap<>(map));
50      }
51    }
52  
53  }