GostBlockungKurs.ts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. import { JavaObject, cast_java_lang_Object } from '../../../java/lang/JavaObject';
  2. import { JavaInteger, cast_java_lang_Integer } from '../../../java/lang/JavaInteger';
  3. import { JavaString, cast_java_lang_String } from '../../../java/lang/JavaString';
  4. export class GostBlockungKurs extends JavaObject {
  5. public id : number = -1;
  6. public fach_id : number = -1;
  7. public kursart : number = 0;
  8. public nummer : number = 0;
  9. public istKoopKurs : boolean = false;
  10. public suffix : String = "";
  11. public wochenstunden : Number | null = 3;
  12. public constructor() {
  13. super();
  14. }
  15. isTranspiledInstanceOf(name : string): boolean {
  16. return ['de.nrw.schule.svws.core.data.gost.GostBlockungKurs'].includes(name);
  17. }
  18. public static transpilerFromJSON(json : string): GostBlockungKurs {
  19. const obj = JSON.parse(json);
  20. const result = new GostBlockungKurs();
  21. if (typeof obj.id === "undefined")
  22. throw new Error('invalid json format, missing attribute id');
  23. result.id = obj.id;
  24. if (typeof obj.fach_id === "undefined")
  25. throw new Error('invalid json format, missing attribute fach_id');
  26. result.fach_id = obj.fach_id;
  27. if (typeof obj.kursart === "undefined")
  28. throw new Error('invalid json format, missing attribute kursart');
  29. result.kursart = obj.kursart;
  30. if (typeof obj.nummer === "undefined")
  31. throw new Error('invalid json format, missing attribute nummer');
  32. result.nummer = obj.nummer;
  33. if (typeof obj.istKoopKurs === "undefined")
  34. throw new Error('invalid json format, missing attribute istKoopKurs');
  35. result.istKoopKurs = obj.istKoopKurs;
  36. if (typeof obj.suffix === "undefined")
  37. throw new Error('invalid json format, missing attribute suffix');
  38. result.suffix = obj.suffix;
  39. result.wochenstunden = typeof obj.wochenstunden === "undefined" ? null : obj.wochenstunden;
  40. return result;
  41. }
  42. public static transpilerToJSON(obj : GostBlockungKurs) : string {
  43. let result = '{';
  44. result += '"id" : ' + obj.id + ',';
  45. result += '"fach_id" : ' + obj.fach_id + ',';
  46. result += '"kursart" : ' + obj.kursart + ',';
  47. result += '"nummer" : ' + obj.nummer + ',';
  48. result += '"istKoopKurs" : ' + obj.istKoopKurs + ',';
  49. result += '"suffix" : ' + '"' + obj.suffix.valueOf() + '"' + ',';
  50. result += '"wochenstunden" : ' + ((!obj.wochenstunden) ? 'null' : obj.wochenstunden.valueOf()) + ',';
  51. result = result.slice(0, -1);
  52. result += '}';
  53. return result;
  54. }
  55. public static transpilerToJSONPatch(obj : Partial<GostBlockungKurs>) : string {
  56. let result = '{';
  57. if (typeof obj.id !== "undefined") {
  58. result += '"id" : ' + obj.id + ',';
  59. }
  60. if (typeof obj.fach_id !== "undefined") {
  61. result += '"fach_id" : ' + obj.fach_id + ',';
  62. }
  63. if (typeof obj.kursart !== "undefined") {
  64. result += '"kursart" : ' + obj.kursart + ',';
  65. }
  66. if (typeof obj.nummer !== "undefined") {
  67. result += '"nummer" : ' + obj.nummer + ',';
  68. }
  69. if (typeof obj.istKoopKurs !== "undefined") {
  70. result += '"istKoopKurs" : ' + obj.istKoopKurs + ',';
  71. }
  72. if (typeof obj.suffix !== "undefined") {
  73. result += '"suffix" : ' + '"' + obj.suffix.valueOf() + '"' + ',';
  74. }
  75. if (typeof obj.wochenstunden !== "undefined") {
  76. result += '"wochenstunden" : ' + ((!obj.wochenstunden) ? 'null' : obj.wochenstunden.valueOf()) + ',';
  77. }
  78. result = result.slice(0, -1);
  79. result += '}';
  80. return result;
  81. }
  82. }
  83. export function cast_de_nrw_schule_svws_core_data_gost_GostBlockungKurs(obj : unknown) : GostBlockungKurs {
  84. return obj as GostBlockungKurs;
  85. }