I'm trying to simplify my code and create one generic method for a number of individual ones. They are pretty much the same except in each of them a differently named constructor is called.
maskTag52A(SwiftBlock4 b4, SwiftMessage m,
String sampleIBANs[]) {
List <Tag> b4tl = b4.getTags();
if (b4.getTagValue("52A") == null)
return;
String[] tagvalues;
tagvalues = b4.getTagValues("52A");
for (int i = 0; i < b4.getTagCount("52A"); i++) {
boolean IBANReplaced = false;
Field52A fl = new Field52A(tagvalues[i]);
in this example I am calling Field52A constructor. I was thinking of building one method and pass a String into it. It would serve as a template for calling the constructor and methods of an object that has been created.
I have this...
genericMaskTagA(String tagA, SwiftBlock4 b4, SwiftMessage m,
String sampleIBANs[]) {
List <Tag> b4tl = b4.getTags();
if (b4.getTagValue(tagA) == null)
return;
String[] tagvalues;
tagvalues = b4.getTagValues(tagA);
for (int i = 0; i < b4.getTagCount(tagA); i++) {
boolean IBANReplaced = false;
Field52A fl = new Field52A(tagvalues[i]);
however I do not know how to pass String tagA to a constructor eg. Field52A.
Field(tagA) does not work
Any ideas?
Regards,
Luke

New Topic/Question
Reply




MultiQuote




|