1 /**********************************************************************
2 * Copyright (c) 2015 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
12 package org
.eclipse
.tracecompass
.internal
.tmf
.remote
.core
.shell
;
14 import static org
.eclipse
.tracecompass
.common
.core
.NonNullUtils
.checkNotNull
;
15 import static org
.eclipse
.tracecompass
.common
.core
.NonNullUtils
.nullToEmptyString
;
17 import java
.util
.ArrayList
;
18 import java
.util
.List
;
20 import org
.eclipse
.jdt
.annotation
.NonNull
;
21 import org
.eclipse
.jdt
.annotation
.Nullable
;
22 import org
.eclipse
.tracecompass
.tmf
.remote
.core
.shell
.ICommandInput
;
24 import com
.google
.common
.collect
.ImmutableList
;
27 * Class for defining command input for remote command execution.
29 * @author Bernd Hufmann
31 public class CommandInput
implements ICommandInput
{
33 // ------------------------------------------------------------------------
35 // ------------------------------------------------------------------------
37 /** The input as list of Strings. */
38 private final @NonNull List
<@NonNull String
> fInput
= new ArrayList
<>();
40 // ------------------------------------------------------------------------
42 // ------------------------------------------------------------------------
45 public List
<String
> getInput() {
46 return checkNotNull(ImmutableList
.copyOf(fInput
));
49 // ------------------------------------------------------------------------
51 // ------------------------------------------------------------------------
54 public void add(@Nullable String segment
) {
55 if (segment
!= null) {
61 public void addAll(List
<String
> segments
) {
62 for (String segment
: segments
) {
68 * Creates a single command string from a command line list.
70 * @return single command string
73 public String
toString() {
74 StringBuilder builder
= new StringBuilder();
75 for (String segment
: getInput()) {
76 builder
.append(segment
).append(' ');
78 return nullToEmptyString(builder
.toString().trim());
This page took 0.035215 seconds and 5 git commands to generate.