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

common-workflow-language / cwljava / #339

29 Jan 2025 01:23PM UTC coverage: 59.538% (-0.6%) from 60.167%
#339

Pull #193

github

web-flow
Merge 94c260498 into 0978523bc
Pull Request #193: Add accessor for the extension field.

0 of 129 new or added lines in 129 files covered. (0.0%)

7347 of 12340 relevant lines covered (59.54%)

0.6 hits per line

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

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

17
import org.w3id.cwl.cwl1_1.utils.LoaderInstances;
18
import org.w3id.cwl.cwl1_1.utils.LoadingOptions;
19
import org.w3id.cwl.cwl1_1.utils.LoadingOptionsBuilder;
20
import org.w3id.cwl.cwl1_1.utils.SaveableImpl;
21
import org.w3id.cwl.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 java.util.Map<String, Object> getExtensionFields() {
NEW
67
    return this.extensionFields_;
×
68
  }
69

70
  private java.util.Optional<Boolean> loadContents;
71

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

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

90
  private Object position;
91

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

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

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

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

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

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

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

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

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

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

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

149
  private Object valueFrom;
150

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

341
    } else {
342
      shellQuote = null;
1✔
343
    }
344
    if (!__errors.isEmpty()) {
1✔
345
      throw new ValidationException("Trying 'RecordField'", __errors);
×
346
    }
347
    this.loadContents = (java.util.Optional<Boolean>) loadContents;
1✔
348
    this.position = (Object) position;
1✔
349
    this.prefix = (java.util.Optional<String>) prefix;
1✔
350
    this.separate = (java.util.Optional<Boolean>) separate;
1✔
351
    this.itemSeparator = (java.util.Optional<String>) itemSeparator;
1✔
352
    this.valueFrom = (Object) valueFrom;
1✔
353
    this.shellQuote = (java.util.Optional<Boolean>) shellQuote;
1✔
354
  }
1✔
355
}
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