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
.nullToEmptyString
;
16 import java
.util
.ArrayList
;
17 import java
.util
.List
;
19 import org
.eclipse
.jdt
.annotation
.NonNull
;
20 import org
.eclipse
.jdt
.annotation
.Nullable
;
21 import org
.eclipse
.tracecompass
.tmf
.remote
.core
.shell
.ICommandInput
;
23 import com
.google
.common
.collect
.ImmutableList
;
26 * Class for defining command input for remote command execution.
28 * @author Bernd Hufmann
30 public class CommandInput
implements ICommandInput
{
32 // ------------------------------------------------------------------------
34 // ------------------------------------------------------------------------
36 /** The input as list of Strings. */
37 private final @NonNull List
<@NonNull String
> fInput
= new ArrayList
<>();
39 // ------------------------------------------------------------------------
41 // ------------------------------------------------------------------------
44 public List
<String
> getInput() {
45 return ImmutableList
.copyOf(fInput
);
48 // ------------------------------------------------------------------------
50 // ------------------------------------------------------------------------
53 public void add(@Nullable String segment
) {
54 if (segment
!= null) {
60 public void addAll(List
<String
> segments
) {
61 for (String segment
: segments
) {
67 * Creates a single command string from a command line list.
69 * @return single command string
72 public String
toString() {
73 StringBuilder builder
= new StringBuilder();
74 for (String segment
: getInput()) {
75 builder
.append(segment
).append(' ');
77 return nullToEmptyString(builder
.toString().trim());
This page took 0.033986 seconds and 5 git commands to generate.