From 0a3b4be16b2b2b8e415a0c0cbd45b265c37bb298 Mon Sep 17 00:00:00 2001 From: Marc Bernard <59966492+mbtools@users.noreply.github.com> Date: Sat, 28 Aug 2021 01:39:28 -0400 Subject: [PATCH] Docs: Expand constructor description (#4914) Describe logic to be used to check requirements and determine if an object type is supported or not. --- docs/collections/_development/serializers.md | 25 ++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docs/collections/_development/serializers.md b/docs/collections/_development/serializers.md index 522bc208a..813c26bc3 100644 --- a/docs/collections/_development/serializers.md +++ b/docs/collections/_development/serializers.md @@ -28,6 +28,31 @@ Parameter | Description These parameters are stored in attributes `MS_ITEM` and `MV_LANGUAGE` respectively. +Requirements that are necessary to support an object type should be checked in the constructor using the following logic. This is typical if object types are not supported in lower releases. + +```abap + METHOD constructor. + + DATA ... + + super->constructor( + is_item = is_item + iv_language = iv_language ). + + TRY. + " Check requirements... + CATCH cx_root. + " Raise exception if not supported + zcx_abapgit_exception=>raise( 'Object type DDLS not supported' ). + ENDTRY. + + ENDMETHOD. +``` + +This will ensure that none of the other class methods are called, even if objects of the given type exist in a repo. + +Example: [`SRFC`](https://github.com/abapGit/abapGit/blob/main/src/objects/zcl_abapgit_object_srfc.clas.abap). + ## Interface Serializers must implement all methods of interface [`ZIF_ABAPGIT_OBJECT`](https://github.com/abapGit/abapGit/blob/main/src/objects/zif_abapgit_object.intf.abap):