All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.reprezen.genflow.common.jsonschema.builder.StructureNode Maven / Gradle / Ivy

package com.reprezen.genflow.common.jsonschema.builder;

import com.fasterxml.jackson.databind.node.ObjectNode;
import com.reprezen.genflow.common.jsonschema.builder.JsonSchemaNodeFactory;
import com.reprezen.genflow.common.jsonschema.builder.NamedSchemaNode;
import com.reprezen.rapidml.Feature;
import com.reprezen.rapidml.Structure;
import org.eclipse.emf.common.util.EList;

@SuppressWarnings("all")
public class StructureNode extends NamedSchemaNode {
  public StructureNode(final JsonSchemaNodeFactory director, final Structure element) {
    super(director, element);
  }
  
  @Override
  public void writeBody(final ObjectNode body) {
    this.writeBasicObject(body);
    this.writeProperties(body);
    this.writeRequiredProperties(body);
  }
  
  protected void writeBasicObject(final ObjectNode body) {
    this.setObjectAsType(body);
    this.putDescription(body, this._zenModelHelper.getDocumentation(this.element));
    this.addVendorExtensions(body, this._extensionsHelper.getRapidExtensions(this.element));
  }
  
  protected ObjectNode writeProperties(final ObjectNode body) {
    final ObjectNode propertiesNode = body.putObject("properties");
    EList _ownedFeatures = this.element.getOwnedFeatures();
    for (final Feature includedProperty : _ownedFeatures) {
      this.factory.createFeatureNode(includedProperty).write(propertiesNode);
    }
    return propertiesNode;
  }
  
  protected ObjectNode writeRequiredProperties(final ObjectNode body) {
    return this.writeRequiredProperties(body, this.getRequiredPropertyNames(this.element));
  }
  
  @Override
  public String getName() {
    return this.element.getName();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy