• 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

55.43
/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 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 compatibility.  Will be removed in
77
   * CWL v2.0.  Use `InputParameter.loadContents` instead.
78
   *    * </BLOCKQUOTE>
79
   */
80

81
  public java.util.Optional<Boolean> getLoadContents() {
82
    return this.loadContents;
×
83
  }
84

85
  private Object position;
86

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

100
  public Object getPosition() {
101
    return this.position;
×
102
  }
103

104
  private java.util.Optional<String> prefix;
105

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

112
  public java.util.Optional<String> getPrefix() {
113
    return this.prefix;
×
114
  }
115

116
  private java.util.Optional<Boolean> separate;
117

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

127
  public java.util.Optional<Boolean> getSeparate() {
128
    return this.separate;
×
129
  }
130

131
  private java.util.Optional<String> itemSeparator;
132

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

141
  public java.util.Optional<String> getItemSeparator() {
142
    return this.itemSeparator;
×
143
  }
144

145
  private Object valueFrom;
146

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

169
  public Object getValueFrom() {
170
    return this.valueFrom;
×
171
  }
172

173
  private java.util.Optional<Boolean> shellQuote;
174

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

187
  public java.util.Optional<Boolean> getShellQuote() {
188
    return this.shellQuote;
×
189
  }
190

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

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

235
    } else {
236
      loadContents = null;
1✔
237
    }
238
    Object position;
239

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

252
    } else {
253
      position = null;
1✔
254
    }
255
    java.util.Optional<String> prefix;
256

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

269
    } else {
270
      prefix = null;
1✔
271
    }
272
    java.util.Optional<Boolean> separate;
273

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

286
    } else {
287
      separate = null;
1✔
288
    }
289
    java.util.Optional<String> itemSeparator;
290

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

303
    } else {
304
      itemSeparator = null;
1✔
305
    }
306
    Object valueFrom;
307

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

320
    } else {
321
      valueFrom = null;
1✔
322
    }
323
    java.util.Optional<Boolean> shellQuote;
324

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

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