1 | |
package org.apache.maven.plugin.invoker; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import java.util.Collection; |
23 | |
import java.util.Map; |
24 | |
import java.util.Properties; |
25 | |
import java.util.Set; |
26 | |
|
27 | |
import org.apache.maven.project.MavenProject; |
28 | |
import org.codehaus.plexus.util.introspection.ReflectionValueExtractor; |
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
class CompositeMap |
36 | |
implements Map |
37 | |
{ |
38 | |
|
39 | |
private MavenProject mavenProject; |
40 | |
|
41 | |
private Properties properties; |
42 | |
|
43 | |
protected CompositeMap( MavenProject mavenProject, Properties properties ) |
44 | 11 | { |
45 | 11 | this.mavenProject = mavenProject; |
46 | 11 | this.properties = properties == null ? new Properties() : properties; |
47 | 11 | } |
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
public void clear() |
53 | |
{ |
54 | |
|
55 | |
|
56 | 0 | } |
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
public boolean containsKey( Object key ) |
62 | |
{ |
63 | 0 | if ( key == null ) |
64 | |
{ |
65 | 0 | return false; |
66 | |
} |
67 | |
try |
68 | |
{ |
69 | 0 | Object evaluated = ReflectionValueExtractor.evaluate( (String) key, this.mavenProject ); |
70 | 0 | return evaluated == null; |
71 | |
} |
72 | 0 | catch ( Exception e ) |
73 | |
{ |
74 | |
|
75 | |
} |
76 | |
|
77 | 0 | return ( mavenProject.getProperties().containsKey( key ) || properties.containsKey( key ) ); |
78 | |
} |
79 | |
|
80 | |
|
81 | |
|
82 | |
|
83 | |
public boolean containsValue( Object value ) |
84 | |
{ |
85 | 0 | throw new UnsupportedOperationException(); |
86 | |
} |
87 | |
|
88 | |
|
89 | |
|
90 | |
|
91 | |
public Set entrySet() |
92 | |
{ |
93 | 0 | throw new UnsupportedOperationException(); |
94 | |
} |
95 | |
|
96 | |
|
97 | |
|
98 | |
|
99 | |
public Object get( Object key ) |
100 | |
{ |
101 | 14 | if ( key == null ) |
102 | |
{ |
103 | 0 | return null; |
104 | |
} |
105 | |
try |
106 | |
{ |
107 | 14 | Object evaluated = ReflectionValueExtractor.evaluate( (String) key, this.mavenProject ); |
108 | 14 | if ( evaluated != null ) |
109 | |
{ |
110 | 6 | return evaluated; |
111 | |
} |
112 | |
} |
113 | 0 | catch ( Exception e ) |
114 | |
{ |
115 | |
|
116 | 8 | } |
117 | |
|
118 | 8 | Object value = properties.get( key ); |
119 | |
|
120 | 8 | return ( value != null ? value : this.mavenProject.getProperties().get( key ) ); |
121 | |
|
122 | |
} |
123 | |
|
124 | |
|
125 | |
|
126 | |
|
127 | |
public boolean isEmpty() |
128 | |
{ |
129 | 0 | return this.mavenProject == null && this.mavenProject.getProperties().isEmpty() && this.properties.isEmpty(); |
130 | |
} |
131 | |
|
132 | |
|
133 | |
|
134 | |
|
135 | |
public Set keySet() |
136 | |
{ |
137 | 0 | throw new UnsupportedOperationException(); |
138 | |
} |
139 | |
|
140 | |
|
141 | |
|
142 | |
|
143 | |
public Object put( Object key, Object value ) |
144 | |
{ |
145 | 0 | throw new UnsupportedOperationException(); |
146 | |
} |
147 | |
|
148 | |
|
149 | |
|
150 | |
|
151 | |
public void putAll( Map t ) |
152 | |
{ |
153 | 0 | throw new UnsupportedOperationException(); |
154 | |
} |
155 | |
|
156 | |
|
157 | |
|
158 | |
|
159 | |
public Object remove( Object key ) |
160 | |
{ |
161 | 0 | throw new UnsupportedOperationException(); |
162 | |
} |
163 | |
|
164 | |
|
165 | |
|
166 | |
|
167 | |
public int size() |
168 | |
{ |
169 | 0 | throw new UnsupportedOperationException(); |
170 | |
} |
171 | |
|
172 | |
|
173 | |
|
174 | |
|
175 | |
public Collection values() |
176 | |
{ |
177 | 0 | throw new UnsupportedOperationException(); |
178 | |
} |
179 | |
} |