diff --git a/src/main/java/com/solab/iso8583/IsoMessage.java b/src/main/java/com/solab/iso8583/IsoMessage.java index 70b04d4..855ec19 100644 --- a/src/main/java/com/solab/iso8583/IsoMessage.java +++ b/src/main/java/com/solab/iso8583/IsoMessage.java @@ -152,8 +152,7 @@ public class IsoMessage { * @param t The ISO type. * @param length The length of the field, used for ALPHA and NUMERIC values only, ignored * with any other type. */ - @SuppressWarnings("unchecked") - public void setValue(int index, Object value, CustomField encoder, IsoType t, int length) { + public void setValue(int index, T value, CustomField encoder, IsoType t, int length) { if (index < 2 || index > 128) { throw new IndexOutOfBoundsException("Field index must be between 2 and 128"); } @@ -162,9 +161,9 @@ public class IsoMessage { } else { IsoValue v = null; if (t.needsLength()) { - v = new IsoValue(t, value, length, encoder); + v = new IsoValue(t, value, length, encoder); } else { - v = new IsoValue(t, value, encoder); + v = new IsoValue(t, value, encoder); } v.setCharacterEncoding(encoding); fields[index] = v; @@ -375,7 +374,7 @@ public class IsoMessage { * not present in the source message it is simply ignored. */ public void copyFieldsFrom(IsoMessage src, int...idx) { for (int i : idx) { - IsoValue v = src.getField(i); + IsoValue v = src.getField(i); if (v == null) { setField(i, null); } else { diff --git a/src/main/java/com/solab/iso8583/MessageFactory.java b/src/main/java/com/solab/iso8583/MessageFactory.java index 8cb0c40..0dd496f 100644 --- a/src/main/java/com/solab/iso8583/MessageFactory.java +++ b/src/main/java/com/solab/iso8583/MessageFactory.java @@ -64,7 +64,7 @@ public class MessageFactory { /** The ISO header to be included in each message type. */ private Map isoHeaders = new HashMap(); /** A map for the custom field encoder/decoders, keyed by field number. */ - private Map> customFields = new HashMap>(); + private Map customFields = new HashMap(); /** Indicates if the current date should be set on new messages (field 7). */ private boolean setDate; /** Indicates if the factory should create binary messages and also parse binary messages. */ @@ -116,7 +116,7 @@ public class MessageFactory { } /** Specifies a map for custom field encoder/decoders. The keys are the field numbers. */ - public void setCustomFields(Map> value) { + public void setCustomFields(Map value) { customFields = value; } @@ -125,11 +125,13 @@ public class MessageFactory { customFields.put(index, value); } /** Returns a custom field encoder/decoder for the specified field number, if one is available. */ - public CustomField getCustomField(int index) { + @SuppressWarnings("unchecked") + public CustomField getCustomField(int index) { return customFields.get(index); } /** Returns a custom field encoder/decoder for the specified field number, if one is available. */ - public CustomField getCustomField(Integer index) { + @SuppressWarnings("unchecked") + public CustomField getCustomField(Integer index) { return customFields.get(index); } diff --git a/src/main/java/com/solab/iso8583/parse/ConfigParser.java b/src/main/java/com/solab/iso8583/parse/ConfigParser.java index 2144b98..fb76749 100644 --- a/src/main/java/com/solab/iso8583/parse/ConfigParser.java +++ b/src/main/java/com/solab/iso8583/parse/ConfigParser.java @@ -147,7 +147,7 @@ public class ConfigParser { length = Integer.parseInt(f.getAttribute("length")); } String v = f.getChildNodes().item(0).getNodeValue(); - CustomField _cf = mfact.getCustomField(num); + CustomField _cf = mfact.getCustomField(num); m.setValue(num, _cf == null ? v : _cf.decodeField(v), _cf, itype, length); } mfact.addMessageTemplate(m);