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

com.regnosys.rosetta.generator.jsonschema.JsonSchemaTranslator Maven / Gradle / Ivy

There is a newer version: 11.22.1
Show newest version
package com.regnosys.rosetta.generator.jsonschema;

import com.regnosys.rosetta.generator.object.ExpandedType;
import org.eclipse.xtext.xbase.lib.StringExtensions;

@SuppressWarnings("all")
public class JsonSchemaTranslator {
  public static String toJsonSchemaBasicType(final String typename) {
    String _switchResult = null;
    if (typename != null) {
      switch (typename) {
        case "string":
        case "time":
        case "date":
        case "dateTime":
        case "zonedDateTime":
        case "calculation":
          _switchResult = "string";
          break;
        case "int":
          _switchResult = "integer";
          break;
        case "number":
          _switchResult = "number";
          break;
        case "boolean":
          _switchResult = "boolean";
          break;
      }
    }
    return _switchResult;
  }

  public static String toJsonSchemaType(final ExpandedType type) {
    final String basicType = JsonSchemaTranslator.toJsonSchemaBasicType(type.getName());
    if ((basicType != null)) {
      return basicType;
    } else {
      return StringExtensions.toFirstUpper(type.getName());
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy