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

common-workflow-language / cwljava / #389

30 Oct 2025 05:13PM UTC coverage: 58.693% (-0.8%) from 59.538%
#389

Pull #218

github

web-flow
Merge 98b159202 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

0.0
/src/main/java/org/w3id/cwl/cwl1_2/RecordFieldImpl.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/salad#RecordField</I><BR> <BLOCKQUOTE>
25
 A field of a record. </BLOCKQUOTE>
26
 */
27
public class RecordFieldImpl extends SaveableImpl implements RecordField {
28
  private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build();
×
29
  private java.util.Map<String, Object> extensionFields_ =
×
30
      new java.util.HashMap<String, Object>();
31
  public LoadingOptions getLoadingOptions() {
NEW
32
    return this.loadingOptions_;
×
33
  }
34
  public java.util.Map<String, Object> getExtensionFields() {
35
    return this.extensionFields_;
×
36
  }
37

38
  private String name;
39

40
  /**
41
   * Getter for property <I>https://w3id.org/cwl/salad#RecordField/name</I><BR>
42
   * <BLOCKQUOTE>
43
   * The name of the field
44
   *    * </BLOCKQUOTE>
45
   */
46

47
  public String getName() {
48
    return this.name;
×
49
  }
50

51
  private Object doc;
52

53
  /**
54
   * Getter for property <I>https://w3id.org/cwl/salad#Documented/doc</I><BR>
55
   * <BLOCKQUOTE>
56
   * A documentation string for this object, or an array of strings which should be concatenated.   * </BLOCKQUOTE>
57
   */
58

59
  public Object getDoc() {
60
    return this.doc;
×
61
  }
62

63
  private Object type;
64

65
  /**
66
   * Getter for property <I>https://w3id.org/cwl/salad#type</I><BR>
67
   * <BLOCKQUOTE>
68
   * The field type. If it is an array, it indicates
69
   * that the field type is a union type of its elements.
70
   * Its elements may be duplicated.
71
   *    * </BLOCKQUOTE>
72
   */
73

74
  public Object getType() {
75
    return this.type;
×
76
  }
77

78
  /**
79
   * Used by {@link org.w3id.cwl.cwl1_2.utils.RootLoader} to construct instances of RecordFieldImpl.
80
   *
81
   * @param __doc_            Document fragment to load this record object from (presumably a
82
                              {@link java.util.Map}).
83
   * @param __baseUri_        Base URI to generate child document IDs against.
84
   * @param __loadingOptions  Context for loading URIs and populating objects.
85
   * @param __docRoot_        ID at this position in the document (if available) (maybe?)
86
   * @throws ValidationException If the document fragment is not a {@link java.util.Map}
87
   *                             or validation of fields fails.
88
   */
89
  public RecordFieldImpl(
90
      final Object __doc_,
91
      final String __baseUri_,
92
      LoadingOptions __loadingOptions,
93
      final String __docRoot_) {
94
    super(__doc_, __baseUri_, __loadingOptions, __docRoot_);
×
95
    // Prefix plumbing variables with '__' to reduce likelihood of collision with
96
    // generated names.
97
    String __baseUri = __baseUri_;
×
98
    String __docRoot = __docRoot_;
×
99
    if (!(__doc_ instanceof java.util.Map)) {
×
100
      throw new ValidationException("RecordFieldImpl called on non-map");
×
101
    }
102
    final java.util.Map<String, Object> __doc = (java.util.Map<String, Object>) __doc_;
×
103
    final java.util.List<ValidationException> __errors =
×
104
        new java.util.ArrayList<ValidationException>();
105
    if (__loadingOptions != null) {
×
106
      this.loadingOptions_ = __loadingOptions;
×
107
    }
108
    String name;
109

110
    if (__doc.containsKey("name")) {
×
111
      try {
112
        name =
×
113
            LoaderInstances
114
                .uri_StringInstance_True_False_None_None
115
                .loadField(__doc.get("name"), __baseUri, __loadingOptions);
×
116
      } catch (ValidationException e) {
×
117
        name = null; // won't be used but prevents compiler from complaining.
×
118
        final String __message = "the `name` field is not valid because:";
×
119
        __errors.add(new ValidationException(__message, e));
×
120
      }
×
121

122
    } else {
123
      name = null;
×
124
    }
125

126
    if (name == null) {
×
127
      if (__docRoot != null) {
×
128
        name = __docRoot;
×
129
      } else {
130
        throw new ValidationException("Missing name");
×
131
      }
132
    }
133
    __baseUri = (String) name;
×
134
    Object doc;
135

136
    if (__doc.containsKey("doc")) {
×
137
      try {
138
        doc =
×
139
            LoaderInstances
140
                .union_of_NullInstance_or_StringInstance_or_array_of_StringInstance
141
                .loadField(__doc.get("doc"), __baseUri, __loadingOptions);
×
142
      } catch (ValidationException e) {
×
143
        doc = null; // won't be used but prevents compiler from complaining.
×
144
        final String __message = "the `doc` field is not valid because:";
×
145
        __errors.add(new ValidationException(__message, e));
×
146
      }
×
147

148
    } else {
149
      doc = null;
×
150
    }
151
    Object type;
152
    try {
153
      type =
×
154
          LoaderInstances
155
              .typedsl_union_of_PrimitiveType_or_RecordSchema_or_EnumSchema_or_ArraySchema_or_MapSchema_or_UnionSchema_or_StringInstance_or_array_of_union_of_PrimitiveType_or_RecordSchema_or_EnumSchema_or_ArraySchema_or_MapSchema_or_UnionSchema_or_StringInstance_2
156
              .loadField(__doc.get("type"), __baseUri, __loadingOptions);
×
157
    } catch (ValidationException e) {
×
158
      type = null; // won't be used but prevents compiler from complaining.
×
159
      final String __message = "the `type` field is not valid because:";
×
160
      __errors.add(new ValidationException(__message, e));
×
161
    }
×
162
    if (!__errors.isEmpty()) {
×
163
      throw new ValidationException("Trying 'RecordField'", __errors);
×
164
    }
165
    this.doc = (Object) doc;
×
166
    this.name = (String) name;
×
167
    this.type = (Object) type;
×
NEW
168
    for (String field:__doc.keySet()) {
×
NEW
169
      if (!attrs.contains(field)) {
×
NEW
170
        if (field.contains(":")) {
×
NEW
171
          String expanded_field = __loadingOptions.expandUrl(field, "", false, false, null);
×
NEW
172
          extensionFields_.put(expanded_field, __doc.get(field));
×
173
        }
174
      }
NEW
175
    }
×
UNCOV
176
  }
×
NEW
177
  private java.util.List<String> attrs = java.util.Arrays.asList("doc", "name", "type");
×
178
}
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