Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ResolveSet |
|
| 2.0;2 |
1 | /* | |
2 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
3 | * you may not use this file except in compliance with the License. | |
4 | * You may obtain a copy of the License at | |
5 | * | |
6 | * http://www.apache.org/licenses/LICENSE-2.0 | |
7 | * | |
8 | * Unless required by applicable law or agreed to in writing, software | |
9 | * distributed under the License is distributed on an "AS IS" BASIS, | |
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
11 | * See the License for the specific language governing permissions and | |
12 | * limitations under the License. | |
13 | */ | |
14 | package org.apache.commons.classscan.util; | |
15 | ||
16 | import org.apache.commons.classscan.spi.model.HasResolve; | |
17 | import org.apache.commons.classscan.spi.model.SpiMetaClassLoader; | |
18 | ||
19 | public class ResolveSet<V extends HasResolve> extends ReadOnlySet<V> { | |
20 | ||
21 | public ResolveSet(V[] values) { | |
22 | 0 | super(values); |
23 | 0 | } |
24 | ||
25 | public boolean resolve(SpiMetaClassLoader mcl) { | |
26 | 0 | for(V value : values) { |
27 | 0 | if(!value.resolve(mcl)) { |
28 | 0 | return false; |
29 | } | |
30 | } | |
31 | 0 | return true; |
32 | } | |
33 | ||
34 | 0 | private static ResolveSet<HasResolve> EMPTY_SET = new ResolveSet<HasResolve>(new HasResolve[0]); |
35 | ||
36 | public static <V extends HasResolve> ResolveSet<V> emptyResolveSet() { | |
37 | @SuppressWarnings("unchecked") | |
38 | 0 | ResolveSet<V> rc = (ResolveSet<V>) EMPTY_SET; |
39 | 0 | return rc; |
40 | } | |
41 | } |