Skip to content

Commit

Permalink
Fixing deprecated Fields
Browse files Browse the repository at this point in the history
  • Loading branch information
ptorres-prowide committed Sep 13, 2024
1 parent 02b340f commit 2c86397
Show file tree
Hide file tree
Showing 44 changed files with 208 additions and 327 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,11 @@ public String getValueDisplay(int component, Locale locale) {
return f.format(cal.getTime());
}
}
if (component == 3) {
// time: HH[mm]
java.text.DateFormat f = new java.text.SimpleDateFormat("HH:mm", notNull(locale));
java.util.Calendar cal = getComponent3AsCalendar();
if (cal != null) {
return f.format(cal.getTime());
}
// time: HH[mm]
java.text.DateFormat f = new java.text.SimpleDateFormat("HH:mm", notNull(locale));
java.util.Calendar cal = getComponent3AsCalendar();
if (cal != null) {
return f.format(cal.getTime());
}
return null;
}
Expand Down Expand Up @@ -766,7 +764,7 @@ public static List<Field11T> getAll(final SwiftTagListBlock block) {
return result;
}
final Tag[] arr = block.getTagsByName(NAME);
if (arr != null && arr.length > 0) {
if (arr != null) {
for (final Tag f : arr) {
result.add(new Field11T(f));
}
Expand Down
14 changes: 4 additions & 10 deletions src/main/java/com/prowidesoftware/swift/model/field/Field12H.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,8 @@ public String getValueDisplay(int component, Locale locale) {
// default format (as is)
return getComponent(1);
}
if (component == 2) {
// default format (as is)
return getComponent(2);
}
return null;
// default format (as is)
return getComponent(2);
}

/**
Expand Down Expand Up @@ -269,10 +266,7 @@ public String validatorPattern() {
*/
@Override
public boolean isOptional(int component) {
if (component == 2) {
return true;
}
return false;
return component == 2;
}

/**
Expand Down Expand Up @@ -475,7 +469,7 @@ public static List<Field12H> getAll(final SwiftTagListBlock block) {
return result;
}
final Tag[] arr = block.getTagsByName(NAME);
if (arr != null && arr.length > 0) {
if (arr != null) {
for (final Tag f : arr) {
result.add(new Field12H(f));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,11 @@ public String getValue() {
*/
@Override
public String getValueDisplay(int component, Locale locale) {
if (component < 1 || component > 1) {
if (component != 1) {
throw new IllegalArgumentException("invalid component number " + component + " for field 12K");
}
if (component == 1) {
// default format (as is)
return getComponent(1);
}
return null;
// default format (as is)
return getComponent(1);
}

/**
Expand Down Expand Up @@ -632,7 +629,7 @@ public static List<Field12K> getAll(final SwiftTagListBlock block) {
return result;
}
final Tag[] arr = block.getTagsByName(NAME);
if (arr != null && arr.length > 0) {
if (arr != null) {
for (final Tag f : arr) {
result.add(new Field12K(f));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,11 @@ public String getValue() {
*/
@Override
public String getValueDisplay(int component, Locale locale) {
if (component < 1 || component > 1) {
if (component != 1) {
throw new IllegalArgumentException("invalid component number " + component + " for field 12L");
}
if (component == 1) {
// default format (as is)
return getComponent(1);
}
return null;
// default format (as is)
return getComponent(1);
}

/**
Expand Down Expand Up @@ -418,7 +415,7 @@ public static List<Field12L> getAll(final SwiftTagListBlock block) {
return result;
}
final Tag[] arr = block.getTagsByName(NAME);
if (arr != null && arr.length > 0) {
if (arr != null) {
for (final Tag f : arr) {
result.add(new Field12L(f));
}
Expand Down
14 changes: 4 additions & 10 deletions src/main/java/com/prowidesoftware/swift/model/field/Field12R.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,8 @@ public String getValueDisplay(int component, Locale locale) {
// default format (as is)
return getComponent(1);
}
if (component == 2) {
// default format (as is)
return getComponent(2);
}
return null;
// default format (as is)
return getComponent(2);
}

/**
Expand Down Expand Up @@ -269,10 +266,7 @@ public String validatorPattern() {
*/
@Override
public boolean isOptional(int component) {
if (component == 2) {
return true;
}
return false;
return component == 2;
}

/**
Expand Down Expand Up @@ -475,7 +469,7 @@ public static List<Field12R> getAll(final SwiftTagListBlock block) {
return result;
}
final Tag[] arr = block.getTagsByName(NAME);
if (arr != null && arr.length > 0) {
if (arr != null) {
for (final Tag f : arr) {
result.add(new Field12R(f));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,11 @@ public String getValue() {
*/
@Override
public String getValueDisplay(int component, Locale locale) {
if (component < 1 || component > 1) {
if (component != 1) {
throw new IllegalArgumentException("invalid component number " + component + " for field 12S");
}
if (component == 1) {
// default format (as is)
return getComponent(1);
}
return null;
// default format (as is)
return getComponent(1);
}

/**
Expand Down Expand Up @@ -418,7 +415,7 @@ public static List<Field12S> getAll(final SwiftTagListBlock block) {
return result;
}
final Tag[] arr = block.getTagsByName(NAME);
if (arr != null && arr.length > 0) {
if (arr != null) {
for (final Tag f : arr) {
result.add(new Field12S(f));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,11 @@ public String getValueDisplay(int component, Locale locale) {
return f.format(cal.getTime());
}
}
if (component == 2) {
// time: HH[mm]
java.text.DateFormat f = new java.text.SimpleDateFormat("HH:mm", notNull(locale));
java.util.Calendar cal = getComponent2AsCalendar();
if (cal != null) {
return f.format(cal.getTime());
}
// time: HH[mm]
java.text.DateFormat f = new java.text.SimpleDateFormat("HH:mm", notNull(locale));
java.util.Calendar cal = getComponent2AsCalendar();
if (cal != null) {
return f.format(cal.getTime());
}
return null;
}
Expand Down Expand Up @@ -584,7 +582,7 @@ public static List<Field13E> getAll(final SwiftTagListBlock block) {
return result;
}
final Tag[] arr = block.getTagsByName(NAME);
if (arr != null && arr.length > 0) {
if (arr != null) {
for (final Tag f : arr) {
result.add(new Field13E(f));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,8 @@ public String getValueDisplay(int component, Locale locale) {
// default format (as is)
return getComponent(1);
}
if (component == 2) {
// default format (as is)
return getComponent(2);
}
return null;
// default format (as is)
return getComponent(2);
}

/**
Expand Down Expand Up @@ -471,7 +468,7 @@ public static List<Field20E> getAll(final SwiftTagListBlock block) {
return result;
}
final Tag[] arr = block.getTagsByName(NAME);
if (arr != null && arr.length > 0) {
if (arr != null) {
for (final Tag f : arr) {
result.add(new Field20E(f));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,11 @@ public String getValue() {
*/
@Override
public String getValueDisplay(int component, Locale locale) {
if (component < 1 || component > 1) {
if (component != 1) {
throw new IllegalArgumentException("invalid component number " + component + " for field 21S");
}
if (component == 1) {
// default format (as is)
return getComponent(1);
}
return null;
// default format (as is)
return getComponent(1);
}

/**
Expand Down Expand Up @@ -418,7 +415,7 @@ public static List<Field21S> getAll(final SwiftTagListBlock block) {
return result;
}
final Tag[] arr = block.getTagsByName(NAME);
if (arr != null && arr.length > 0) {
if (arr != null) {
for (final Tag f : arr) {
result.add(new Field21S(f));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,11 @@ public String getValue() {
*/
@Override
public String getValueDisplay(int component, Locale locale) {
if (component < 1 || component > 1) {
if (component != 1) {
throw new IllegalArgumentException("invalid component number " + component + " for field 21T");
}
if (component == 1) {
// default format (as is)
return getComponent(1);
}
return null;
// default format (as is)
return getComponent(1);
}

/**
Expand Down Expand Up @@ -418,7 +415,7 @@ public static List<Field21T> getAll(final SwiftTagListBlock block) {
return result;
}
final Tag[] arr = block.getTagsByName(NAME);
if (arr != null && arr.length > 0) {
if (arr != null) {
for (final Tag f : arr) {
result.add(new Field21T(f));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,11 @@ public String getValue() {
*/
@Override
public String getValueDisplay(int component, Locale locale) {
if (component < 1 || component > 1) {
if (component != 1) {
throw new IllegalArgumentException("invalid component number " + component + " for field 25F");
}
if (component == 1) {
// default format (as is)
return getComponent(1);
}
return null;
// default format (as is)
return getComponent(1);
}

/**
Expand Down Expand Up @@ -418,7 +415,7 @@ public static List<Field25F> getAll(final SwiftTagListBlock block) {
return result;
}
final Tag[] arr = block.getTagsByName(NAME);
if (arr != null && arr.length > 0) {
if (arr != null) {
for (final Tag f : arr) {
result.add(new Field25F(f));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,11 @@ public String getValue() {
*/
@Override
public String getValueDisplay(int component, Locale locale) {
if (component < 1 || component > 1) {
if (component != 1) {
throw new IllegalArgumentException("invalid component number " + component + " for field 25G");
}
if (component == 1) {
// default format (as is)
return getComponent(1);
}
return null;
// default format (as is)
return getComponent(1);
}

/**
Expand Down Expand Up @@ -418,7 +415,7 @@ public static List<Field25G> getAll(final SwiftTagListBlock block) {
return result;
}
final Tag[] arr = block.getTagsByName(NAME);
if (arr != null && arr.length > 0) {
if (arr != null) {
for (final Tag f : arr) {
result.add(new Field25G(f));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,8 @@ public String getValueDisplay(int component, Locale locale) {
// default format (as is)
return getComponent(1);
}
if (component == 2) {
// default format (as is)
return getComponent(2);
}
return null;
// default format (as is)
return getComponent(2);
}

/**
Expand Down Expand Up @@ -716,7 +713,7 @@ public static List<Field27A> getAll(final SwiftTagListBlock block) {
return result;
}
final Tag[] arr = block.getTagsByName(NAME);
if (arr != null && arr.length > 0) {
if (arr != null) {
for (final Tag f : arr) {
result.add(new Field27A(f));
}
Expand Down
14 changes: 4 additions & 10 deletions src/main/java/com/prowidesoftware/swift/model/field/Field29D.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,8 @@ public String getValueDisplay(int component, Locale locale) {
// default format (as is)
return getComponent(3);
}
if (component == 4) {
// default format (as is)
return getComponent(4);
}
return null;
// default format (as is)
return getComponent(4);
}

/**
Expand Down Expand Up @@ -277,10 +274,7 @@ public boolean isOptional(int component) {
if (component == 3) {
return true;
}
if (component == 4) {
return true;
}
return false;
return component == 4;
}

/**
Expand Down Expand Up @@ -603,7 +597,7 @@ public static List<Field29D> getAll(final SwiftTagListBlock block) {
return result;
}
final Tag[] arr = block.getTagsByName(NAME);
if (arr != null && arr.length > 0) {
if (arr != null) {
for (final Tag f : arr) {
result.add(new Field29D(f));
}
Expand Down
Loading

0 comments on commit 2c86397

Please sign in to comment.