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

common-workflow-language / cwljava / #388

30 Oct 2025 04:55PM UTC coverage: 58.693% (-0.8%) from 59.538%
#388

Pull #218

github

web-flow
Merge ab8576a5b into befd7e4b9
Pull Request #218: Populate the extensionFields; add public accessors for LoadingOptions

230 of 569 new or added lines in 67 files covered. (40.42%)

28 existing lines in 27 files now uncovered.

7535 of 12838 relevant lines covered (58.69%)

0.59 hits per line

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

55.0
/src/main/java/org/w3id/cwl/cwl1_2/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.w3id.cwl.cwl1_2;
16

17
import org.w3id.cwl.cwl1_2.utils.LoaderInstances;
18
import org.w3id.cwl.cwl1_2.utils.LoadingOptions;
19
import org.w3id.cwl.cwl1_2.utils.LoadingOptionsBuilder;
20
import org.w3id.cwl.cwl1_2.utils.SaveableImpl;
21
import org.w3id.cwl.cwl1_2.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 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() {
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 compatibility.  Will be removed in
80
   * CWL v2.0.  Use `InputParameter.loadContents` instead.
81
   *    * </BLOCKQUOTE>
82
   */
83

84
  public java.util.Optional<Boolean> getLoadContents() {
85
    return this.loadContents;
×
86
  }
87

88
  private Object position;
89

90
  /**
91
   * Getter for property <I>https://w3id.org/cwl/cwl#CommandLineBinding/position</I><BR>
92
   * <BLOCKQUOTE>
93
   * The sorting key.  Default position is 0. If a [CWL Parameter Reference](#Parameter_references)
94
   * or [CWL Expression](#Expressions_(Optional)) is used and if the
95
   * inputBinding is associated with an input parameter, then the value of
96
   * `self` will be the value of the input parameter.  Input parameter
97
   * defaults (as specified by the `InputParameter.default` field) must be
98
   * applied before evaluating the expression. Expressions must return a
99
   * single value of type int or a null.
100
   *    * </BLOCKQUOTE>
101
   */
102

103
  public Object getPosition() {
104
    return this.position;
×
105
  }
106

107
  private java.util.Optional<String> prefix;
108

109
  /**
110
   * Getter for property <I>https://w3id.org/cwl/cwl#CommandLineBinding/prefix</I><BR>
111
   * <BLOCKQUOTE>
112
   * Command line prefix to add before the value.   * </BLOCKQUOTE>
113
   */
114

115
  public java.util.Optional<String> getPrefix() {
116
    return this.prefix;
×
117
  }
118

119
  private java.util.Optional<Boolean> separate;
120

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

130
  public java.util.Optional<Boolean> getSeparate() {
131
    return this.separate;
×
132
  }
133

134
  private java.util.Optional<String> itemSeparator;
135

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

144
  public java.util.Optional<String> getItemSeparator() {
145
    return this.itemSeparator;
×
146
  }
147

148
  private Object valueFrom;
149

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

172
  public Object getValueFrom() {
173
    return this.valueFrom;
×
174
  }
175

176
  private java.util.Optional<Boolean> shellQuote;
177

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

190
  public java.util.Optional<Boolean> getShellQuote() {
191
    return this.shellQuote;
×
192
  }
193

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

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

238
    } else {
239
      loadContents = null;
1✔
240
    }
241
    Object position;
242

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

255
    } else {
256
      position = null;
1✔
257
    }
258
    java.util.Optional<String> prefix;
259

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

272
    } else {
273
      prefix = null;
1✔
274
    }
275
    java.util.Optional<Boolean> separate;
276

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

289
    } else {
290
      separate = null;
1✔
291
    }
292
    java.util.Optional<String> itemSeparator;
293

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

306
    } else {
307
      itemSeparator = null;
1✔
308
    }
309
    Object valueFrom;
310

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

323
    } else {
324
      valueFrom = null;
1✔
325
    }
326
    java.util.Optional<Boolean> shellQuote;
327

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

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

© 2026 Coveralls, Inc