prowide-iso20022 icon indicating copy to clipboard operation
prowide-iso20022 copied to clipboard

Non-static getters for static fields on children of com.prowidesoftware.swift.model.mx.AbstractMX

Open vhortal opened this issue 2 years ago • 1 comments

Taking as example the class com.prowidesoftware.swift.model.mx.MxPacs00800108, I see getters like public int getFunctionality() public int getVariant() public int getVersion() among others. These refer to static fields, so in my view the getters should also be declared static.

I have faced problems while trying to serialize instances of these classes as JSON with Jackson, because the non-static getters make the static fields appear as properties, so they get serialized into the JSON object, hence including elements such as "functionality", "variant", "version" that do not belong to the model.

The issue seems to affect most of the inheritors of AbstractMX, possibly also present in other packages.

vhortal avatar Jun 24 '22 18:06 vhortal

Hello vhortal, in case you need to serialize any of those instances you can use this approach:

    MxPacs00800108 msg = ...
    String jsonMsg = msg.toJson();

ptorres-prowide avatar Sep 02 '22 01:09 ptorres-prowide