View Javadoc
1   package org.apache.turbine.services.urlmapper.model;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.util.List;
23  import java.util.concurrent.CopyOnWriteArrayList;
24  
25  import javax.xml.bind.annotation.XmlAccessType;
26  import javax.xml.bind.annotation.XmlAccessorType;
27  import javax.xml.bind.annotation.XmlAttribute;
28  import javax.xml.bind.annotation.XmlElement;
29  import javax.xml.bind.annotation.XmlElementWrapper;
30  import javax.xml.bind.annotation.XmlRootElement;
31  
32  import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
33  import com.fasterxml.jackson.annotation.JsonProperty;
34  
35  /**
36   * URL Map Container Model Class
37   *
38   * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
39   */
40  @XmlRootElement(name="url-mapping")
41  @XmlAccessorType(XmlAccessType.NONE)
42  @JsonIgnoreProperties(ignoreUnknown = true)
43  public class URLMappingContainer
44  {
45  
46      /**
47       * Name of this map.
48       */
49      @XmlAttribute
50      private String name;
51  
52      /**
53       * The list of map entries
54       */
55      @JsonProperty("maps")
56      private List<URLMapEntry> urlMapEntries = new CopyOnWriteArrayList<>();
57  
58      /**
59       * Set the name of this map.
60       *
61       * @param name
62       *            Name of this map.
63       */
64      protected void setName(String name)
65      {
66          this.name = name;
67      }
68  
69      /**
70       * Get the name of this map.
71       *
72       * @return String Name of this map.
73       */
74      public String getName()
75      {
76          return name;
77      }
78  
79      /**
80       * Get the list of map entries
81       */
82      @XmlElementWrapper(name="maps")
83      @XmlElement(name="map")
84      public List<URLMapEntry> getMapEntries()
85      {
86          return urlMapEntries;
87      }
88  
89      /**
90       * Set new map entries during deserialization
91       *
92       * @param newURLMapEntries the newURLMapEntries to set
93       */
94      protected void setMapEntries(List<URLMapEntry> newURLMapEntries)
95      {
96          this.urlMapEntries = new CopyOnWriteArrayList<>(newURLMapEntries);
97      }
98  }