KursblockungOutputKursZuSchiene.ts 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import { JavaObject, cast_java_lang_Object } from '../../../java/lang/JavaObject';
  2. export class KursblockungOutputKursZuSchiene extends JavaObject {
  3. public enmRevision : number = -1;
  4. public kurs : number = 0;
  5. public schienen : Array<number> = Array(0).fill(0);
  6. public constructor() {
  7. super();
  8. }
  9. isTranspiledInstanceOf(name : string): boolean {
  10. return ['de.nrw.schule.svws.core.data.kursblockung.KursblockungOutputKursZuSchiene'].includes(name);
  11. }
  12. public static transpilerFromJSON(json : string): KursblockungOutputKursZuSchiene {
  13. const obj = JSON.parse(json);
  14. const result = new KursblockungOutputKursZuSchiene();
  15. if (typeof obj.enmRevision === "undefined")
  16. throw new Error('invalid json format, missing attribute enmRevision');
  17. result.enmRevision = obj.enmRevision;
  18. if (typeof obj.kurs === "undefined")
  19. throw new Error('invalid json format, missing attribute kurs');
  20. result.kurs = obj.kurs;
  21. for (let i : number = 0; i < obj.schienen.length; i++) {
  22. result.schienen[i] = obj.schienen[i];
  23. }
  24. return result;
  25. }
  26. public static transpilerToJSON(obj : KursblockungOutputKursZuSchiene) : string {
  27. let result = '{';
  28. result += '"enmRevision" : ' + obj.enmRevision + ',';
  29. result += '"kurs" : ' + obj.kurs + ',';
  30. if (!obj.schienen) {
  31. result += '[]';
  32. } else {
  33. result += '[ ';
  34. for (let i : number = 0; i < obj.schienen.length; i++) {
  35. let elem = obj.schienen[i];
  36. result += JSON.stringify(elem);
  37. if (i < obj.schienen.length - 1)
  38. result += ',';
  39. }
  40. result += ' ]' + ',';
  41. }
  42. result = result.slice(0, -1);
  43. result += '}';
  44. return result;
  45. }
  46. public static transpilerToJSONPatch(obj : Partial<KursblockungOutputKursZuSchiene>) : string {
  47. let result = '{';
  48. if (typeof obj.enmRevision !== "undefined") {
  49. result += '"enmRevision" : ' + obj.enmRevision + ',';
  50. }
  51. if (typeof obj.kurs !== "undefined") {
  52. result += '"kurs" : ' + obj.kurs + ',';
  53. }
  54. if (typeof obj.schienen !== "undefined") {
  55. let a = obj.schienen;
  56. if (!a) {
  57. result += '[]';
  58. } else {
  59. result += '[ ';
  60. for (let i : number = 0; i < a.length; i++) {
  61. let elem = a[i];
  62. result += JSON.stringify(elem);
  63. if (i < a.length - 1)
  64. result += ',';
  65. }
  66. result += ' ]' + ',';
  67. }
  68. }
  69. result = result.slice(0, -1);
  70. result += '}';
  71. return result;
  72. }
  73. }
  74. export function cast_de_nrw_schule_svws_core_data_kursblockung_KursblockungOutputKursZuSchiene(obj : unknown) : KursblockungOutputKursZuSchiene {
  75. return obj as KursblockungOutputKursZuSchiene;
  76. }