001package org.galaxyproject.gxformat2.v19_09;
002
003import org.galaxyproject.gxformat2.v19_09.utils.LoaderInstances;
004import org.galaxyproject.gxformat2.v19_09.utils.LoadingOptions;
005import org.galaxyproject.gxformat2.v19_09.utils.LoadingOptionsBuilder;
006import org.galaxyproject.gxformat2.v19_09.utils.SavableImpl;
007import org.galaxyproject.gxformat2.v19_09.utils.ValidationException;
008
009/** Auto-generated class implementation for <I>https://w3id.org/cwl/salad#ArraySchema</I><br> */
010public class ArraySchemaImpl extends SavableImpl implements ArraySchema {
011  private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build();
012  private java.util.Map<String, Object> extensionFields_ = new java.util.HashMap<String, Object>();
013
014  private Object items;
015
016  /**
017   * Getter for property <I>https://w3id.org/cwl/salad#items</I><br>
018   *
019   * <BLOCKQUOTE>
020   *
021   * Defines the type of the array elements. *
022   *
023   * </BLOCKQUOTE>
024   */
025  public Object getItems() {
026    return this.items;
027  }
028
029  private enum_d062602be0b4b8fd33e69e29a841317b6ab665bc type;
030
031  /**
032   * Getter for property <I>https://w3id.org/cwl/salad#type</I><br>
033   *
034   * <BLOCKQUOTE>
035   *
036   * Must be `array` *
037   *
038   * </BLOCKQUOTE>
039   */
040  public enum_d062602be0b4b8fd33e69e29a841317b6ab665bc getType() {
041    return this.type;
042  }
043
044  /**
045   * Used by {@link org.galaxyproject.gxformat2.v19_09.utils.RootLoader} to construct instances of
046   * ArraySchemaImpl.
047   *
048   * @param __doc_ Document fragment to load this record object from (presumably a {@link
049   *     java.util.Map}).
050   * @param __baseUri_ Base URI to generate child document IDs against.
051   * @param __loadingOptions Context for loading URIs and populating objects.
052   * @param __docRoot_ ID at this position in the document (if available) (maybe?)
053   * @throws ValidationException If the document fragment is not a {@link java.util.Map} or
054   *     validation of fields fails.
055   */
056  public ArraySchemaImpl(
057      final Object __doc_,
058      final String __baseUri_,
059      LoadingOptions __loadingOptions,
060      final String __docRoot_) {
061    super(__doc_, __baseUri_, __loadingOptions, __docRoot_);
062    // Prefix plumbing variables with '__' to reduce likelihood of collision with
063    // generated names.
064    String __baseUri = __baseUri_;
065    String __docRoot = __docRoot_;
066    if (!(__doc_ instanceof java.util.Map)) {
067      throw new ValidationException("ArraySchemaImpl called on non-map");
068    }
069    final java.util.Map<String, Object> __doc = (java.util.Map<String, Object>) __doc_;
070    final java.util.List<ValidationException> __errors =
071        new java.util.ArrayList<ValidationException>();
072    if (__loadingOptions != null) {
073      this.loadingOptions_ = __loadingOptions;
074    }
075    Object items;
076    try {
077      items =
078          LoaderInstances
079              .uri_union_of_PrimitiveType_or_RecordSchema_or_EnumSchema_or_ArraySchema_or_StringInstance_or_array_of_union_of_PrimitiveType_or_RecordSchema_or_EnumSchema_or_ArraySchema_or_StringInstance_False_True_2
080              .loadField(__doc.get("items"), __baseUri, __loadingOptions);
081    } catch (ValidationException e) {
082      items = null; // won't be used but prevents compiler from complaining.
083      final String __message = "the `items` field is not valid because:";
084      __errors.add(new ValidationException(__message, e));
085    }
086    enum_d062602be0b4b8fd33e69e29a841317b6ab665bc type;
087    try {
088      type =
089          LoaderInstances.typedsl_enum_d062602be0b4b8fd33e69e29a841317b6ab665bc_2.loadField(
090              __doc.get("type"), __baseUri, __loadingOptions);
091    } catch (ValidationException e) {
092      type = null; // won't be used but prevents compiler from complaining.
093      final String __message = "the `type` field is not valid because:";
094      __errors.add(new ValidationException(__message, e));
095    }
096    if (!__errors.isEmpty()) {
097      throw new ValidationException("Trying 'RecordField'", __errors);
098    }
099    this.items = (Object) items;
100    this.type = (enum_d062602be0b4b8fd33e69e29a841317b6ab665bc) type;
101  }
102}