All files / output zcl_abapgit_json_path.clas.mjs

85.71% Statements 54/63
46.15% Branches 6/13
55.55% Functions 5/9
85.71% Lines 54/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 6x 6x 6x 6x 6x 6x 6x 6x 1x 6x 6x 6x 1x 3x 3x 3x 3x 3x 3x 3x 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x     3x               3x 3x 3x 3x 3x 1x 1x 1x
await import("./zcl_abapgit_json_path.clas.locals.mjs");
const {cx_root} = await import("./cx_root.clas.mjs");
// zcl_abapgit_json_path.clas.abap
class zcl_abapgit_json_path {
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'ZCL_ABAPGIT_JSON_PATH';
  static IMPLEMENTED_INTERFACES = [];
  static ATTRIBUTES = {};
  static METHODS = {"SERIALIZE": {"visibility": "U", "parameters": {"RT_RESULT": {"type": () => {return abap.types.TableFactory.construct(new abap.types.String({qualifiedName: "STRING"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"isUnique":false,"type":"STANDARD","keyFields":[],"name":"primary_key"},"secondary":[]}, "STRING_TABLE");}, "is_optional": " "}, "IV_JSON": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}},
  "DESERIALIZE": {"visibility": "U", "parameters": {"RV_RESULT": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IT_JSON_PATH": {"type": () => {return abap.types.TableFactory.construct(new abap.types.String({qualifiedName: "STRING"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"isUnique":false,"type":"STANDARD","keyFields":[],"name":"primary_key"},"secondary":[]}, "STRING_TABLE");}, "is_optional": " "}}}};
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
      "serialize": this.serialize.bind(this),
      "deserialize": this.deserialize.bind(this),
    };
  }
  async constructor_(INPUT) {
    if (super.constructor_) { await super.constructor_(INPUT); }
    return this;
  }
  async deserialize(INPUT) {
    let rv_result = new abap.types.String({qualifiedName: "STRING"});
    let it_json_path = INPUT?.it_json_path;
    if (it_json_path?.getQualifiedName === undefined || it_json_path.getQualifiedName() !== "STRING_TABLE") { it_json_path = undefined; }
    if (it_json_path === undefined) { it_json_path = abap.types.TableFactory.construct(new abap.types.String({qualifiedName: "STRING"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"isUnique":false,"type":"STANDARD","keyFields":[],"name":"primary_key"},"secondary":[]}, "STRING_TABLE").set(INPUT.it_json_path); }
    rv_result.set((await abap.Classes['CLAS-ZCL_ABAPGIT_JSON_PATH-LCL_JSON_PATH'].deserialize({it_json_path: it_json_path})));
    return rv_result;
  }
  async serialize(INPUT) {
    let rt_result = abap.types.TableFactory.construct(new abap.types.String({qualifiedName: "STRING"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"isUnique":false,"type":"STANDARD","keyFields":[],"name":"primary_key"},"secondary":[]}, "STRING_TABLE");
    let iv_json = INPUT?.iv_json;
    if (iv_json?.getQualifiedName === undefined || iv_json.getQualifiedName() !== "STRING") { iv_json = undefined; }
    if (iv_json === undefined) { iv_json = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_json); }
    let lo_json_path = new abap.types.ABAPObject({qualifiedName: "LCL_JSON_PATH", RTTIName: "\\CLASS-POOL=ZCL_ABAPGIT_JSON_PATH\\CLASS=LCL_JSON_PATH"});
    let lv_json_xstring = new abap.types.XString({qualifiedName: "XSTRING"});
    let lt_root_path = abap.types.TableFactory.construct(new abap.types.String({qualifiedName: "STRING"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"isUnique":false,"type":"STANDARD","keyFields":[],"name":"primary_key"},"secondary":[]}, "STRING_TABLE");
    let lo_reader = new abap.types.ABAPObject({qualifiedName: "IF_SXML_READER", RTTIName: "\\INTERFACE=IF_SXML_READER"});
    let lx_parse_error = new abap.types.ABAPObject({qualifiedName: "CX_SXML_PARSE_ERROR", RTTIName: "\\CLASS=CX_SXML_PARSE_ERROR"});
    lv_json_xstring.set((await abap.Classes['ZCL_ABAPGIT_CONVERT'].string_to_xstring_utf8({iv_string: iv_json})));
    lo_reader.set((await abap.Classes['CL_SXML_STRING_READER'].create({input: lv_json_xstring})));
    try {
      if (abap.compare.initial((await lo_reader.get().if_sxml_reader$read_next_node()))) {
        return rt_result;
      }
    } catch (e) {
      if ((abap.Classes['CX_SXML_PARSE_ERROR'] && e instanceof abap.Classes['CX_SXML_PARSE_ERROR'])) {
        lx_parse_error.set(e);
        await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise_with_text({ix_previous: lx_parse_error});
      } else {
        throw e;
      }
    }
    abap.statements.append({source: new abap.types.String().set(`$`), target: lt_root_path});
    lo_json_path.set(await (new abap.Classes['CLAS-ZCL_ABAPGIT_JSON_PATH-LCL_JSON_PATH']()).constructor_());
    await lo_json_path.get().serialize_rec({io_reader: lo_reader, it_path: lt_root_path, ct_json_paths: rt_result});
    return rt_result;
  }
}
abap.Classes['ZCL_ABAPGIT_JSON_PATH'] = zcl_abapgit_json_path;
export {zcl_abapgit_json_path};