KursblockungInputRegel.ts 2.4 KB

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