Package: CompoundCommandResolver

CompoundCommandResolver

nameinstructionbranchcomplexitylinemethod
CompoundCommandResolver(CommandResolver[])
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
resolveCommands(ServiceReference, Object)
M: 30 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2008, 2010 VMware Inc.
3: * All rights reserved. This program and the accompanying materials
4: * are made available under the terms of the Eclipse Public License v1.0
5: * which accompanies this distribution, and is available at
6: * http://www.eclipse.org/legal/epl-v10.html
7: *
8: * Contributors:
9: * VMware Inc. - initial contribution
10: *******************************************************************************/
11:
12: package org.eclipse.virgo.shell.internal;
13:
14: import java.util.ArrayList;
15: import java.util.List;
16:
17: import org.osgi.framework.ServiceReference;
18:
19: /**
20: * A <code>CommandResolver</code> that combines results from one or more delegates.
21: *
22: * <p />
23: *
24: * <strong>Concurrent Semantics</strong><br />
25: *
26: * Thread-safe.
27: *
28: */
29: final class CompoundCommandResolver implements CommandResolver {
30:
31: private final CommandResolver[] commandResolvers;
32:
33: CompoundCommandResolver(CommandResolver... commandResolvers) {
34: this.commandResolvers = commandResolvers;
35: }
36:
37: /**
38: * {@inheritDoc}
39: */
40: public List<CommandDescriptor> resolveCommands(ServiceReference<?> serviceReference, Object service) {
41: List<CommandDescriptor> commandDescriptors = new ArrayList<CommandDescriptor>();
42:
43:• for (CommandResolver commandResolver : commandResolvers) {
44: commandDescriptors.addAll(commandResolver.resolveCommands(serviceReference, service));
45: }
46:
47: return commandDescriptors;
48: }
49: }