• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

common-workflow-language / cwljava / #394

31 Oct 2025 04:10PM UTC coverage: 57.972% (-1.6%) from 59.538%
#394

push

github

mr-c
rename package to a namespace that we control

7575 of 12994 new or added lines in 261 files covered. (58.3%)

7752 of 13372 relevant lines covered (57.97%)

0.58 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

58.0
/src/main/java/org/commonwl/cwlsdk/cwl1_1/CommandLineBindingImpl.java
1
// Copyright Common Workflow Language project contributors
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//      http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15
package org.commonwl.cwlsdk.cwl1_1;
16

17
import org.commonwl.cwlsdk.cwl1_1.utils.LoaderInstances;
18
import org.commonwl.cwlsdk.cwl1_1.utils.LoadingOptions;
19
import org.commonwl.cwlsdk.cwl1_1.utils.LoadingOptionsBuilder;
20
import org.commonwl.cwlsdk.cwl1_1.utils.SaveableImpl;
21
import org.commonwl.cwlsdk.cwl1_1.utils.ValidationException;
22

23
/**
24
* Auto-generated class implementation for <I>https://w3id.org/cwl/cwl#CommandLineBinding</I><BR> <BLOCKQUOTE>
25
 
26
 When listed under `inputBinding` in the input schema, the term
27
 "value" refers to the the corresponding value in the input object.  For
28
 binding objects listed in `CommandLineTool.arguments`, the term "value"
29
 refers to the effective value after evaluating `valueFrom`.
30
 
31
 The binding behavior when building the command line depends on the data
32
 type of the value.  If there is a mismatch between the type described by
33
 the input schema and the effective value, such as resulting from an
34
 expression evaluation, an implementation must use the data type of the
35
 effective value.
36
 
37
   - **string**: Add `prefix` and the string to the command line.
38
 
39
   - **number**: Add `prefix` and decimal representation to command line.
40
 
41
   - **boolean**: If true, add `prefix` to the command line.  If false, add
42
       nothing.
43
 
44
   - **File**: Add `prefix` and the value of
45
     [`File.path`](#File) to the command line.
46
 
47
   - **Directory**: Add `prefix` and the value of
48
     [`Directory.path`](#Directory) to the command line.
49
 
50
   - **array**: If `itemSeparator` is specified, add `prefix` and the join
51
       the array into a single string with `itemSeparator` separating the
52
       items.  Otherwise first add `prefix`, then recursively process
53
       individual elements.
54
       If the array is empty, it does not add anything to command line.
55
 
56
   - **object**: Add `prefix` only, and recursively add object fields for
57
       which `inputBinding` is specified.
58
 
59
   - **null**: Add nothing.
60
  </BLOCKQUOTE>
61
 */
62
public class CommandLineBindingImpl extends SaveableImpl implements CommandLineBinding {
63
  private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build();
1✔
64
  private java.util.Map<String, Object> extensionFields_ =
1✔
65
      new java.util.HashMap<String, Object>();
66
  public LoadingOptions getLoadingOptions() {
NEW
67
    return this.loadingOptions_;
×
68
  }
69
  public java.util.Map<String, Object> getExtensionFields() {
NEW
70
    return this.extensionFields_;
×
71
  }
72

73
  private java.util.Optional<Boolean> loadContents;
74

75
  /**
76
   * Getter for property <I>https://w3id.org/cwl/cwl#InputBinding/loadContents</I><BR>
77
   * <BLOCKQUOTE>
78
   * Use of `loadContents` in `InputBinding` is deprecated.
79
   * Preserved for v1.0 backwards compatability.  Will be removed in
80
   * CWL v2.0.  Use `InputParameter.loadContents` instead.
81
   * 
82
   * Only valid when `type: File` or is an array of `items: File`.
83
   * 
84
   * Read up to the first 64 KiB of text from the file and place it in the
85
   * "contents" field of the file object for use by expressions.
86
   *    * </BLOCKQUOTE>
87
   */
88

89
  public java.util.Optional<Boolean> getLoadContents() {
NEW
90
    return this.loadContents;
×
91
  }
92

93
  private Object position;
94

95
  /**
96
   * Getter for property <I>https://w3id.org/cwl/cwl#CommandLineBinding/position</I><BR>
97
   * <BLOCKQUOTE>
98
   * The sorting key.  Default position is 0. If the inputBinding is
99
   * associated with an input parameter, then the value of `self` in the
100
   * expression will be the value of the input parameter.  Input parameter
101
   * defaults (as specified by the `InputParameter.default` field) must be
102
   * applied before evaluating the expression. Expressions must return a
103
   * single value of type int or a null.
104
   *    * </BLOCKQUOTE>
105
   */
106

107
  public Object getPosition() {
NEW
108
    return this.position;
×
109
  }
110

111
  private java.util.Optional<String> prefix;
112

113
  /**
114
   * Getter for property <I>https://w3id.org/cwl/cwl#CommandLineBinding/prefix</I><BR>
115
   * <BLOCKQUOTE>
116
   * Command line prefix to add before the value.   * </BLOCKQUOTE>
117
   */
118

119
  public java.util.Optional<String> getPrefix() {
NEW
120
    return this.prefix;
×
121
  }
122

123
  private java.util.Optional<Boolean> separate;
124

125
  /**
126
   * Getter for property <I>https://w3id.org/cwl/cwl#CommandLineBinding/separate</I><BR>
127
   * <BLOCKQUOTE>
128
   * If true (default), then the prefix and value must be added as separate
129
   * command line arguments; if false, prefix and value must be concatenated
130
   * into a single command line argument.
131
   *    * </BLOCKQUOTE>
132
   */
133

134
  public java.util.Optional<Boolean> getSeparate() {
NEW
135
    return this.separate;
×
136
  }
137

138
  private java.util.Optional<String> itemSeparator;
139

140
  /**
141
   * Getter for property <I>https://w3id.org/cwl/cwl#CommandLineBinding/itemSeparator</I><BR>
142
   * <BLOCKQUOTE>
143
   * Join the array elements into a single string with the elements
144
   * separated by by `itemSeparator`.
145
   *    * </BLOCKQUOTE>
146
   */
147

148
  public java.util.Optional<String> getItemSeparator() {
NEW
149
    return this.itemSeparator;
×
150
  }
151

152
  private Object valueFrom;
153

154
  /**
155
   * Getter for property <I>https://w3id.org/cwl/cwl#CommandLineBinding/valueFrom</I><BR>
156
   * <BLOCKQUOTE>
157
   * If `valueFrom` is a constant string value, use this as the value and
158
   * apply the binding rules above.
159
   * 
160
   * If `valueFrom` is an expression, evaluate the expression to yield the
161
   * actual value to use to build the command line and apply the binding
162
   * rules above.  If the inputBinding is associated with an input
163
   * parameter, the value of `self` in the expression will be the value of
164
   * the input parameter.  Input parameter defaults (as specified by the
165
   * `InputParameter.default` field) must be applied before evaluating the
166
   * expression.
167
   * 
168
   * If the value of the associated input parameter is `null`, `valueFrom` is
169
   * not evaluated and nothing is added to the command line.
170
   * 
171
   * When a binding is part of the `CommandLineTool.arguments` field,
172
   * the `valueFrom` field is required.
173
   *    * </BLOCKQUOTE>
174
   */
175

176
  public Object getValueFrom() {
NEW
177
    return this.valueFrom;
×
178
  }
179

180
  private java.util.Optional<Boolean> shellQuote;
181

182
  /**
183
   * Getter for property <I>https://w3id.org/cwl/cwl#CommandLineBinding/shellQuote</I><BR>
184
   * <BLOCKQUOTE>
185
   * If `ShellCommandRequirement` is in the requirements for the current command,
186
   * this controls whether the value is quoted on the command line (default is true).
187
   * Use `shellQuote: false` to inject metacharacters for operations such as pipes.
188
   * 
189
   * If `shellQuote` is true or not provided, the implementation must not
190
   * permit interpretation of any shell metacharacters or directives.
191
   *    * </BLOCKQUOTE>
192
   */
193

194
  public java.util.Optional<Boolean> getShellQuote() {
NEW
195
    return this.shellQuote;
×
196
  }
197

198
  /**
199
   * Used by {@link org.commonwl.cwlsdk.cwl1_1.utils.RootLoader} to construct instances of CommandLineBindingImpl.
200
   *
201
   * @param __doc_            Document fragment to load this record object from (presumably a
202
                              {@link java.util.Map}).
203
   * @param __baseUri_        Base URI to generate child document IDs against.
204
   * @param __loadingOptions  Context for loading URIs and populating objects.
205
   * @param __docRoot_        ID at this position in the document (if available) (maybe?)
206
   * @throws ValidationException If the document fragment is not a {@link java.util.Map}
207
   *                             or validation of fields fails.
208
   */
209
  public CommandLineBindingImpl(
210
      final Object __doc_,
211
      final String __baseUri_,
212
      LoadingOptions __loadingOptions,
213
      final String __docRoot_) {
214
    super(__doc_, __baseUri_, __loadingOptions, __docRoot_);
1✔
215
    // Prefix plumbing variables with '__' to reduce likelihood of collision with
216
    // generated names.
217
    String __baseUri = __baseUri_;
1✔
218
    String __docRoot = __docRoot_;
1✔
219
    if (!(__doc_ instanceof java.util.Map)) {
1✔
NEW
220
      throw new ValidationException("CommandLineBindingImpl called on non-map");
×
221
    }
222
    final java.util.Map<String, Object> __doc = (java.util.Map<String, Object>) __doc_;
1✔
223
    final java.util.List<ValidationException> __errors =
1✔
224
        new java.util.ArrayList<ValidationException>();
225
    if (__loadingOptions != null) {
1✔
226
      this.loadingOptions_ = __loadingOptions;
1✔
227
    }
228
    java.util.Optional<Boolean> loadContents;
229

230
    if (__doc.containsKey("loadContents")) {
1✔
231
      try {
232
        loadContents =
1✔
233
            LoaderInstances
234
                .optional_BooleanInstance
235
                .loadField(__doc.get("loadContents"), __baseUri, __loadingOptions);
1✔
NEW
236
      } catch (ValidationException e) {
×
NEW
237
        loadContents = null; // won't be used but prevents compiler from complaining.
×
NEW
238
        final String __message = "the `loadContents` field is not valid because:";
×
NEW
239
        __errors.add(new ValidationException(__message, e));
×
240
      }
1✔
241

242
    } else {
243
      loadContents = null;
1✔
244
    }
245
    Object position;
246

247
    if (__doc.containsKey("position")) {
1✔
248
      try {
249
        position =
1✔
250
            LoaderInstances
251
                .union_of_NullInstance_or_IntegerInstance_or_ExpressionLoader
252
                .loadField(__doc.get("position"), __baseUri, __loadingOptions);
1✔
NEW
253
      } catch (ValidationException e) {
×
NEW
254
        position = null; // won't be used but prevents compiler from complaining.
×
NEW
255
        final String __message = "the `position` field is not valid because:";
×
NEW
256
        __errors.add(new ValidationException(__message, e));
×
257
      }
1✔
258

259
    } else {
260
      position = null;
1✔
261
    }
262
    java.util.Optional<String> prefix;
263

264
    if (__doc.containsKey("prefix")) {
1✔
265
      try {
266
        prefix =
1✔
267
            LoaderInstances
268
                .optional_StringInstance
269
                .loadField(__doc.get("prefix"), __baseUri, __loadingOptions);
1✔
NEW
270
      } catch (ValidationException e) {
×
NEW
271
        prefix = null; // won't be used but prevents compiler from complaining.
×
NEW
272
        final String __message = "the `prefix` field is not valid because:";
×
NEW
273
        __errors.add(new ValidationException(__message, e));
×
274
      }
1✔
275

276
    } else {
277
      prefix = null;
1✔
278
    }
279
    java.util.Optional<Boolean> separate;
280

281
    if (__doc.containsKey("separate")) {
1✔
282
      try {
283
        separate =
1✔
284
            LoaderInstances
285
                .optional_BooleanInstance
286
                .loadField(__doc.get("separate"), __baseUri, __loadingOptions);
1✔
NEW
287
      } catch (ValidationException e) {
×
NEW
288
        separate = null; // won't be used but prevents compiler from complaining.
×
NEW
289
        final String __message = "the `separate` field is not valid because:";
×
NEW
290
        __errors.add(new ValidationException(__message, e));
×
291
      }
1✔
292

293
    } else {
294
      separate = null;
1✔
295
    }
296
    java.util.Optional<String> itemSeparator;
297

298
    if (__doc.containsKey("itemSeparator")) {
1✔
299
      try {
300
        itemSeparator =
1✔
301
            LoaderInstances
302
                .optional_StringInstance
303
                .loadField(__doc.get("itemSeparator"), __baseUri, __loadingOptions);
1✔
NEW
304
      } catch (ValidationException e) {
×
NEW
305
        itemSeparator = null; // won't be used but prevents compiler from complaining.
×
NEW
306
        final String __message = "the `itemSeparator` field is not valid because:";
×
NEW
307
        __errors.add(new ValidationException(__message, e));
×
308
      }
1✔
309

310
    } else {
311
      itemSeparator = null;
1✔
312
    }
313
    Object valueFrom;
314

315
    if (__doc.containsKey("valueFrom")) {
1✔
316
      try {
317
        valueFrom =
1✔
318
            LoaderInstances
319
                .union_of_NullInstance_or_StringInstance_or_ExpressionLoader
320
                .loadField(__doc.get("valueFrom"), __baseUri, __loadingOptions);
1✔
NEW
321
      } catch (ValidationException e) {
×
NEW
322
        valueFrom = null; // won't be used but prevents compiler from complaining.
×
NEW
323
        final String __message = "the `valueFrom` field is not valid because:";
×
NEW
324
        __errors.add(new ValidationException(__message, e));
×
325
      }
1✔
326

327
    } else {
328
      valueFrom = null;
1✔
329
    }
330
    java.util.Optional<Boolean> shellQuote;
331

332
    if (__doc.containsKey("shellQuote")) {
1✔
333
      try {
334
        shellQuote =
1✔
335
            LoaderInstances
336
                .optional_BooleanInstance
337
                .loadField(__doc.get("shellQuote"), __baseUri, __loadingOptions);
1✔
NEW
338
      } catch (ValidationException e) {
×
NEW
339
        shellQuote = null; // won't be used but prevents compiler from complaining.
×
NEW
340
        final String __message = "the `shellQuote` field is not valid because:";
×
NEW
341
        __errors.add(new ValidationException(__message, e));
×
342
      }
1✔
343

344
    } else {
345
      shellQuote = null;
1✔
346
    }
347
    if (!__errors.isEmpty()) {
1✔
NEW
348
      throw new ValidationException("Trying 'RecordField'", __errors);
×
349
    }
350
    this.loadContents = (java.util.Optional<Boolean>) loadContents;
1✔
351
    this.position = (Object) position;
1✔
352
    this.prefix = (java.util.Optional<String>) prefix;
1✔
353
    this.separate = (java.util.Optional<Boolean>) separate;
1✔
354
    this.itemSeparator = (java.util.Optional<String>) itemSeparator;
1✔
355
    this.valueFrom = (Object) valueFrom;
1✔
356
    this.shellQuote = (java.util.Optional<Boolean>) shellQuote;
1✔
357
    for (String field:__doc.keySet()) {
1✔
358
      if (!attrs.contains(field)) {
1✔
NEW
359
        if (field.contains(":")) {
×
NEW
360
          String expanded_field = __loadingOptions.expandUrl(field, "", false, false, null);
×
NEW
361
          extensionFields_.put(expanded_field, __doc.get(field));
×
362
        }
363
      }
364
    }
1✔
365
  }
1✔
366
  private java.util.List<String> attrs = java.util.Arrays.asList("loadContents", "position", "prefix", "separate", "itemSeparator", "valueFrom", "shellQuote");
1✔
367
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc