KursblockungOutputs.ts 2.5 KB

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