Finish improvement of generics usage, modifiying a couple of methods in MessageFactory (for accessing CustomField encoders) and ConfigParser (for using said CustomFields)

git-svn-id: https://j8583.svn.sourceforge.net/svnroot/j8583/j8583@92 db60a039-f72e-0410-b1d2-baa000846441
This commit is contained in:
chochos
2011-08-11 15:35:42 +00:00
parent 9f5a7d59af
commit 13e60ee567
3 changed files with 11 additions and 10 deletions
@@ -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 <T> void setValue(int index, T value, CustomField<T> 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>(t, value, length, encoder);
} else {
v = new IsoValue(t, value, encoder);
v = new IsoValue<T>(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<Object> v = src.getField(i);
if (v == null) {
setField(i, null);
} else {