Package: SimpleCommandApplication
SimpleCommandApplication
name | instruction | branch | complexity | line | method | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SimpleCommandApplication(Function) |
|
|
|
|
|
||||||||||||||||||||
executeCommand(String) |
|
|
|
|
|
Coverage
1: /*******************************************************************************
2: * Copyright (c) 2017, 2022 Red Hat Inc and others
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Red Hat Inc - initial API and implementation
12: *******************************************************************************/
13: package org.eclipse.kapua.kura.simulator.app.command;
14:
15: import java.util.Objects;
16: import java.util.function.Function;
17:
18: public class SimpleCommandApplication extends AbstractCommandApplication {
19:
20: private final Function<String, String> handler;
21:
22: public SimpleCommandApplication(final Function<String, String> handler) {
23: Objects.requireNonNull(handler);
24: this.handler = handler;
25: }
26:
27: @Override
28: public Result executeCommand(final String command) {
29: return new Result(this.handler.apply(command), "", 0, false);
30: }
31:
32: }