Skip to content

Commit f63c00a

Browse files
CU-86b3verm1_Code-cleanupimprovement
1 parent d483a0f commit f63c00a

File tree

7 files changed

+66
-25
lines changed

7 files changed

+66
-25
lines changed

src/main/java/com/prowidesoftware/deprecation/package-info.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616
/**
17-
* Classes to support Prowide deprecation policy: <a href="http://www.prowidesoftware.com/resources/deprecation-policy">Deprecation Policy</a>
17+
* Classes to support Prowide deprecation policy:
18+
* <a href="http://www.prowidesoftware.com/resources/deprecation-policy">Deprecation Policy</a>
1819
*/
1920
package com.prowidesoftware.deprecation;

src/main/java/com/prowidesoftware/swift/model/SwiftValueBlock.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
import java.util.logging.Level;
2020

2121
/**
22-
* Base class for SWIFT blocks that contain its fields concatenated as a single <b>fixed length</b> value; blocks 1 and 2.<br>
22+
* Base class for SWIFT blocks that contain its fields concatenated as a single <b>fixed length</b>
23+
* value; blocks 1 and 2.<br>
2324
* This is an <b>abstract</b> class so specific block classes for each block should be instantiated.
2425
*
2526
* @author sebastian
@@ -29,7 +30,7 @@ public abstract class SwiftValueBlock extends SwiftBlock implements Serializable
2930
private static final long serialVersionUID = -3680693640473937755L;
3031

3132
@SuppressWarnings("unused")
32-
private static final transient java.util.logging.Logger log =
33+
private static final java.util.logging.Logger LOGGER =
3334
java.util.logging.Logger.getLogger(SwiftValueBlock.class.getName());
3435

3536
/**
@@ -135,7 +136,7 @@ protected String getValuePart(final String value, final int start, int size) {
135136
try {
136137
s = value.substring(start, start + boundedSize);
137138
} catch (final IndexOutOfBoundsException e) {
138-
log.log(Level.SEVERE, "Exception parsing value part", e);
139+
LOGGER.log(Level.SEVERE, "Exception parsing value part", e);
139140
}
140141
}
141142
return s;

src/main/java/com/prowidesoftware/swift/model/Tag.java

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class Tag implements Serializable {
4242
/**
4343
* List of unparsed texts. For performance reasons, this will be null until really needed.
4444
*/
45-
protected UnparsedTextList unparsedTexts = null;
45+
protected UnparsedTextList unparsedTexts;
4646

4747
/**
4848
* Default constructor.
@@ -66,7 +66,8 @@ public Tag(Tag tag) {
6666
* <p>
6767
* If inner contains one ':' character, the string before is set as the tag name and the rest as the value.
6868
* If inner contains more than one ':' characters, then the first value is used as previously described.
69-
* If no ':' character is found the whole string is set as the tag value and the tag name is kept null (useful for bloc data)
69+
* If no ':' character is found the whole string is set as the tag value and the tag name is kept
70+
* null (useful for bloc data)
7071
*
7172
* <p>
7273
* Maps:
@@ -96,7 +97,9 @@ public Tag(String inner) {
9697
this.value = inner.substring(i + 1);
9798
}
9899
} else {
99-
if (inner.length() > 0) this.value = inner;
100+
if (!inner.isEmpty()) {
101+
this.value = inner;
102+
}
100103
}
101104
}
102105

@@ -216,7 +219,9 @@ public String toString() {
216219
* verifies that the unparsed text list exists
217220
*/
218221
protected void unparsedTextVerify() {
219-
if (this.unparsedTexts == null) this.unparsedTexts = new UnparsedTextList();
222+
if (this.unparsedTexts == null) {
223+
this.unparsedTexts = new UnparsedTextList();
224+
}
220225
}
221226

222227
/**
@@ -249,7 +254,9 @@ public void setUnparsedTexts(UnparsedTextList texts) {
249254
public Integer getUnparsedTextsSize() {
250255

251256
// no list => size is zero...
252-
if (this.unparsedTexts == null) return 0;
257+
if (this.unparsedTexts == null) {
258+
return 0;
259+
}
253260
return this.unparsedTexts.size();
254261
}
255262

@@ -326,8 +333,12 @@ public void unparsedTextAddText(SwiftMessage message) {
326333

327334
@Override
328335
public boolean equals(Object o) {
329-
if (this == o) return true;
330-
if (o == null || getClass() != o.getClass()) return false;
336+
if (this == o) {
337+
return true;
338+
}
339+
if (o == null || getClass() != o.getClass()) {
340+
return false;
341+
}
331342
Tag tag = (Tag) o;
332343
return Objects.equals(name, tag.name)
333344
&& Objects.equals(value, tag.value)
@@ -348,17 +359,31 @@ public int hashCode() {
348359
* @since 7.9.3
349360
*/
350361
public boolean equalsIgnoreCR(Tag other) {
351-
if (other == null) return false;
352-
if (this == other) return true;
362+
if (other == null) {
363+
return false;
364+
}
365+
if (this == other) {
366+
return true;
367+
}
353368
if (name == null) {
354-
if (other.name != null) return false;
355-
} else if (!name.equals(other.name)) return false;
369+
if (other.name != null) {
370+
return false;
371+
}
372+
} else if (!name.equals(other.name)) {
373+
return false;
374+
}
356375
if (unparsedTexts == null) {
357-
if (other.unparsedTexts != null) return false;
358-
} else if (!unparsedTexts.equals(other.unparsedTexts)) return false;
376+
if (other.unparsedTexts != null) {
377+
return false;
378+
}
379+
} else if (!unparsedTexts.equals(other.unparsedTexts)) {
380+
return false;
381+
}
359382
if (value == null) {
360383
return other.value == null;
361-
} else return StringUtils.replace(value, "\r", "").equals(StringUtils.replace(other.value, "\r", ""));
384+
} else {
385+
return StringUtils.replace(value, "\r", "").equals(StringUtils.replace(other.value, "\r", ""));
386+
}
362387
}
363388

364389
/**

src/main/java/com/prowidesoftware/swift/model/TagVisitor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ public interface TagVisitor {
2121
* Visit the current tag
2222
*
2323
* @param tag the current tag
24-
* @return <code>true</code> if the visitor should continue with further tags if any or <code>false</code> to abort the visiting process
24+
* @return <code>true</code> if the visitor should continue
25+
* with further tags if any or <code>false</code> to abort the visiting process
2526
*/
2627
boolean onTag(Tag tag);
2728
}

src/main/java/com/prowidesoftware/swift/model/UETRUtils.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@
2323
*
2424
* @since 9.1.4
2525
*/
26-
public class UETRUtils {
26+
public final class UETRUtils {
2727

28+
private UETRUtils() {
29+
// utility class
30+
}
2831
/**
2932
* Creates a new random UETR compatible with MT block 3 field 121
3033
*/

src/main/java/com/prowidesoftware/swift/model/UnparsedTextList.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717

1818
import com.prowidesoftware.swift.io.ConversionService;
1919
import java.io.Serializable;
20-
import java.util.*;
20+
import java.util.ArrayList;
21+
import java.util.Collection;
22+
import java.util.List;
23+
import java.util.Objects;
2124
import org.apache.commons.lang3.builder.ToStringBuilder;
2225

2326
/**
@@ -277,8 +280,12 @@ public void removeText(final String text) {
277280

278281
@Override
279282
public boolean equals(Object o) {
280-
if (this == o) return true;
281-
if (o == null || getClass() != o.getClass()) return false;
283+
if (this == o) {
284+
return true;
285+
}
286+
if (o == null || getClass() != o.getClass()) {
287+
return false;
288+
}
282289
UnparsedTextList that = (UnparsedTextList) o;
283290
return Objects.equals(texts, that.texts);
284291
}

src/main/java/com/prowidesoftware/swift/model/field/package-info.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
*
1919
* <p>This package provides classes to parse and model every possible field and letter option of a SWIFT MT message.
2020
*
21-
* <p>The constructor of each field class accepts the field's literal value and parses its content into a list of components with a simple and generic API of getComponent1() ... getComponentN().<br>
22-
* Components are modeled as string, but if the component represents a date or number, additional API is provided to get the component parsed into a Calendar and Number with methods like getComponent1AsCalendar() and getComponent3AsNumber().
21+
* <p>The constructor of each field class accepts the field's literal value and parses its content into a
22+
* list of components with a simple and generic API of getComponent1() ... getComponentN().<br>
23+
* Components are modeled as string, but if the component represents a date or number, additional API is
24+
* provided to get the component parsed into a Calendar and Number with methods
25+
* like getComponent1AsCalendar() and getComponent3AsNumber().
2326
*/
2427
package com.prowidesoftware.swift.model.field;

0 commit comments

Comments
 (0)