View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.myfaces.config.impl.digester.elements;
20  
21  import java.util.ArrayList;
22  import java.util.Collections;
23  import java.util.List;
24  import org.apache.myfaces.config.element.ContractMapping;
25  
26  /**
27   *
28   * @author lu4242
29   */
30  public class ContractMappingImpl extends ContractMapping
31  {
32      private List<String> urlPatternList;
33      private List<String> contractsList;
34      
35      private transient List <String> unmodifiableUrlPatternList;
36      private transient List <String> unmodifiableContractsList;
37  
38      /**
39       * @return the urlPattern
40       */
41      public List<String> getUrlPatternList()
42      {
43          if (urlPatternList == null)
44          {
45              return Collections.emptyList();
46          }
47          if (unmodifiableUrlPatternList == null)
48          {
49              unmodifiableUrlPatternList = 
50                  Collections.unmodifiableList(urlPatternList);
51          }
52          return unmodifiableUrlPatternList;
53      }
54  
55      /**
56       * @return the contracts
57       */
58      public List<String> getContractList()
59      {
60          if (contractsList == null)
61          {
62              return Collections.emptyList();
63          }
64          if (unmodifiableContractsList == null)
65          {
66              unmodifiableContractsList = 
67                  Collections.unmodifiableList(contractsList);
68          }
69          return unmodifiableContractsList;
70      }
71  
72      public void addContract(String contract)
73      {
74          if (contractsList == null)
75          {
76              contractsList = new ArrayList<String>();
77          }
78          contractsList.add(contract);
79      }
80      
81      public void addUrlPattern(String urlPattern)
82      {
83          if (urlPatternList == null)
84          {
85              urlPatternList = new ArrayList<String>();
86          }
87          urlPatternList.add(urlPattern);
88      }
89  
90      @Override
91      public String getUrlPattern()
92      {
93          return null;
94      }
95  
96      @Override
97      public String getContracts()
98      {
99          return null;
100     }
101 }