Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||||
CompositeMap |
|
| 1.6666666666666667;1.667 |
1 | package org.apache.maven.plugin.war; |
|
2 | ||
3 | /* |
|
4 | * Copyright 2001-2006 The Apache Software Foundation. |
|
5 | * |
|
6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
|
7 | * you may not use this file except in compliance with the License. |
|
8 | * 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, software |
|
13 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15 | * See the License for the specific language governing permissions and |
|
16 | * limitations under the License. |
|
17 | */ |
|
18 | ||
19 | import java.util.AbstractMap; |
|
20 | import java.util.Collections; |
|
21 | import java.util.Map; |
|
22 | import java.util.Set; |
|
23 | ||
24 | /** |
|
25 | * @version $Id: CompositeMap.java 417362 2006-06-27 07:30:32Z brett $ |
|
26 | * @todo merge with resources/assembly plugin |
|
27 | */ |
|
28 | public class CompositeMap |
|
29 | extends AbstractMap |
|
30 | { |
|
31 | private Map recessive; |
|
32 | ||
33 | private Map dominant; |
|
34 | ||
35 | public CompositeMap( Map dominant, Map recessive ) |
|
36 | 18 | { |
37 | 18 | this.dominant = Collections.unmodifiableMap( dominant ); |
38 | ||
39 | 18 | this.recessive = Collections.unmodifiableMap( recessive ); |
40 | 18 | } |
41 | ||
42 | public synchronized Object get( Object key ) |
|
43 | { |
|
44 | 54 | Object value = dominant.get( key ); |
45 | ||
46 | 54 | if ( value == null ) |
47 | { |
|
48 | 42 | value = recessive.get( key ); |
49 | } |
|
50 | ||
51 | 54 | return value; |
52 | } |
|
53 | ||
54 | public Set entrySet() |
|
55 | { |
|
56 | 0 | throw new UnsupportedOperationException( "Cannot enumerate properties in a composite map" ); |
57 | } |
|
58 | } |