All files / output zcl_abapgit_oo_factory.clas.mjs

42.85% Statements 27/63
60% Branches 3/5
18.18% Functions 2/11
42.85% Lines 27/63

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 631x 1x 1x 1x 1x 1x 1x 1x 1x 1x             1x       1x     1x 1x 1x 1x 1x   1x 1x 1x 1x 1x 1x     1x                                             1x 1x 1x
const {cx_root} = await import("./cx_root.clas.mjs");
// zcl_abapgit_oo_factory.clas.abap
class zcl_abapgit_oo_factory {
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'ZCL_ABAPGIT_OO_FACTORY';
  static IMPLEMENTED_INTERFACES = [];
  static ATTRIBUTES = {};
  static METHODS = {"GET_BY_TYPE": {"visibility": "U", "parameters": {"RI_OBJECT_ORIENTED_OBJECT": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_OO_OBJECT_FNC", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_OO_OBJECT_FNC"});}, "is_optional": " "}, "IV_OBJECT_TYPE": {"type": () => {return new abap.types.Character(4, {});}, "is_optional": " "}}},
  "GET_BY_NAME": {"visibility": "U", "parameters": {"RI_OBJECT_ORIENTED_OBJECT": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_OO_OBJECT_FNC", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_OO_OBJECT_FNC"});}, "is_optional": " "}, "IV_OBJECT_NAME": {"type": () => {return new abap.types.Character(30, {"qualifiedName":"SEOCLSNAME","ddicName":"SEOCLSNAME","description":"SEOCLSNAME"});}, "is_optional": " "}}}};
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
    };
  }
  async constructor_(INPUT) {
    if (super.constructor_) { await super.constructor_(INPUT); }
    return this;
  }
  async get_by_type(INPUT) {
    return zcl_abapgit_oo_factory.get_by_type(INPUT);
  }
  static async get_by_type(INPUT) {
    let ri_object_oriented_object = new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_OO_OBJECT_FNC", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_OO_OBJECT_FNC"});
    let iv_object_type = INPUT?.iv_object_type;
    if (iv_object_type === undefined) { iv_object_type = new abap.types.Character(4, {}).set(INPUT.iv_object_type); }
    if (abap.compare.eq(iv_object_type, abap.CharacterFactory.get(4, 'CLAS'))) {
      ri_object_oriented_object.set(await (new abap.Classes['ZCL_ABAPGIT_OO_CLASS']()).constructor_());
    } else if (abap.compare.eq(iv_object_type, abap.CharacterFactory.get(4, 'INTF'))) {
      ri_object_oriented_object.set(await (new abap.Classes['ZCL_ABAPGIT_OO_INTERFACE']()).constructor_());
    }
    return ri_object_oriented_object;
  }
  async get_by_name(INPUT) {
    return zcl_abapgit_oo_factory.get_by_name(INPUT);
  }
  static async get_by_name(INPUT) {
    let ri_object_oriented_object = new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_OO_OBJECT_FNC", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_OO_OBJECT_FNC"});
    let iv_object_name = INPUT?.iv_object_name;
    if (iv_object_name?.getQualifiedName === undefined || iv_object_name.getQualifiedName() !== "SEOCLSNAME") { iv_object_name = undefined; }
    if (iv_object_name === undefined) { iv_object_name = new abap.types.Character(30, {"qualifiedName":"SEOCLSNAME","ddicName":"SEOCLSNAME","description":"SEOCLSNAME"}).set(INPUT.iv_object_name); }
    let li_interface = new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_OO_OBJECT_FNC", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_OO_OBJECT_FNC"});
    let li_class = new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_OO_OBJECT_FNC", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_OO_OBJECT_FNC"});
    let ls_object_name = new abap.types.Structure({
    "clsname": new abap.types.Character(30, {"qualifiedName":"SEOCLSNAME","ddicName":"SEOCLSNAME","description":"SEOCLSNAME"})}, "SEOCLSKEY", "SEOCLSKEY", {}, {});
    ls_object_name.get().clsname.set(abap.builtin.to_upper({val: iv_object_name}));
    li_class.set(await (new abap.Classes['ZCL_ABAPGIT_OO_CLASS']()).constructor_());
    if (abap.compare.eq((await li_class.get().zif_abapgit_oo_object_fnc$exists({iv_object_name: ls_object_name.get().clsname})), abap.builtin.abap_true)) {
      ri_object_oriented_object.set(li_class);
      return ri_object_oriented_object;
    }
    li_interface.set(await (new abap.Classes['ZCL_ABAPGIT_OO_INTERFACE']()).constructor_());
    if (abap.compare.eq((await li_interface.get().zif_abapgit_oo_object_fnc$exists({iv_object_name: ls_object_name.get().clsname})), abap.builtin.abap_true)) {
      ri_object_oriented_object.set(li_interface);
      return ri_object_oriented_object;
    }
    await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`${abap.templateFormatting(iv_object_name)} is neither a class nor an interface`)});
    return ri_object_oriented_object;
  }
}
abap.Classes['ZCL_ABAPGIT_OO_FACTORY'] = zcl_abapgit_oo_factory;
export {zcl_abapgit_oo_factory};