java - How to retrieve field values by passing field name using JPOS ISO8583 message format -
i want retrieve field values passing filed name .in order achieve have implemented method loop through isomsg object , if found match passed filed name returns .my requirement read .xml file once , have static map using on next time retrieve corresponding value passing field name in order achieve there way retrieve field in config xml.
protected static void getiso8583valuebyfieldname(isomsg isomsg, string fieldname) { (int = 1; <= isomsg.getmaxfield(); i++) { if (isomsg.hasfield(i)) { if (isomsg.getpackager().getfielddescription(isomsg, i).equalsignorecase(fieldname)) { system.out.println( " found field -" + + " : " + isomsg.getstring(i) + " " + isomsg.getpackager() .getfielddescription(isomsg, i)); break; } } }
}
you can define enum field names, mapped field numbers. please note field names may vary packager packager, solution kind of brittle, it's better use enum, or constants.
Comments
Post a Comment