diamond op #32

This commit is contained in:
Enrique Zamudio
2015-02-19 19:55:24 -06:00
parent fa4006f270
commit e278903423
8 changed files with 37 additions and 37 deletions

View File

@@ -49,12 +49,12 @@ public class AlphaParseInfo extends AlphaNumericFieldParseInfo {
}
try {
if (custom == null) {
return new IsoValue<String>(type, new String(buf, pos, length, getCharacterEncoding()), length, null);
return new IsoValue<>(type, new String(buf, pos, length, getCharacterEncoding()), length, null);
} else {
T decoded = custom.decodeField(new String(buf, pos, length, getCharacterEncoding()));
return decoded == null ?
new IsoValue<String>(type, new String(buf, pos, length, getCharacterEncoding()), length, null) :
new IsoValue<T>(type, decoded, length, custom);
new IsoValue<>(type, new String(buf, pos, length, getCharacterEncoding()), length, null) :
new IsoValue<>(type, decoded, length, custom);
}
} catch (IndexOutOfBoundsException ex) {
throw new ParseException(String.format(

View File

@@ -51,7 +51,7 @@ public class AmountParseInfo extends FieldParseInfo {
}
String c = new String(buf, pos, 12, getCharacterEncoding());
try {
return new IsoValue<BigDecimal>(type, new BigDecimal(c).movePointLeft(2));
return new IsoValue<>(type, new BigDecimal(c).movePointLeft(2));
} catch (NumberFormatException ex) {
throw new ParseException(String.format("Cannot read amount '%s' field %d pos %d",
c, field, pos), pos);
@@ -76,7 +76,7 @@ public class AmountParseInfo extends FieldParseInfo {
}
}
try {
return new IsoValue<BigDecimal>(IsoType.AMOUNT, new BigDecimal(new String(digits)));
return new IsoValue<>(IsoType.AMOUNT, new BigDecimal(new String(digits)));
} catch (NumberFormatException ex) {
throw new ParseException(String.format("Cannot read amount '%s' field %d pos %d",
new String(digits), field, pos), pos);

View File

@@ -52,11 +52,11 @@ public class BinaryParseInfo extends FieldParseInfo {
}
byte[] binval = HexCodec.hexDecode(new String(buf, pos, length*2));
if (custom == null) {
return new IsoValue<byte[]>(type, binval, binval.length, null);
return new IsoValue<>(type, binval, binval.length, null);
} else {
T dec = custom.decodeField(new String(buf, pos, length*2, getCharacterEncoding()));
return dec == null ? new IsoValue<byte[]>(type, binval, binval.length, null) :
new IsoValue<T>(type, dec, length, custom);
return dec == null ? new IsoValue<>(type, binval, binval.length, null) :
new IsoValue<>(type, dec, length, custom);
}
}
@@ -75,11 +75,11 @@ public class BinaryParseInfo extends FieldParseInfo {
byte[] _v = new byte[length];
System.arraycopy(buf, pos, _v, 0, length);
if (custom == null) {
return new IsoValue<byte[]>(type, _v, length, null);
return new IsoValue<>(type, _v, length, null);
} else {
T dec = custom.decodeField(HexCodec.hexEncode(_v, 0, _v.length));
return dec == null ? new IsoValue<byte[]>(type, _v, length, null) :
new IsoValue<T>(type, dec, length, custom);
return dec == null ? new IsoValue<>(type, _v, length, null) :
new IsoValue<>(type, dec, length, custom);
}
}

View File

@@ -71,7 +71,7 @@ public class Date10ParseInfo extends DateTimeParseInfo {
cal.setTimeZone(tz);
}
adjustWithFutureTolerance(cal);
return new IsoValue<Date>(type, cal.getTime(), null);
return new IsoValue<>(type, cal.getTime(), null);
}
@Override
@@ -105,7 +105,7 @@ public class Date10ParseInfo extends DateTimeParseInfo {
cal.setTimeZone(tz);
}
adjustWithFutureTolerance(cal);
return new IsoValue<Date>(type, cal.getTime(), null);
return new IsoValue<>(type, cal.getTime(), null);
}
}

View File

@@ -66,7 +66,7 @@ public class Date4ParseInfo extends DateTimeParseInfo {
cal.setTimeZone(tz);
}
Date10ParseInfo.adjustWithFutureTolerance(cal);
return new IsoValue<Date>(type, cal.getTime(), null);
return new IsoValue<>(type, cal.getTime(), null);
}
@Override
@@ -94,7 +94,7 @@ public class Date4ParseInfo extends DateTimeParseInfo {
cal.setTimeZone(tz);
}
DateTimeParseInfo.adjustWithFutureTolerance(cal);
return new IsoValue<Date>(type, cal.getTime(), null);
return new IsoValue<>(type, cal.getTime(), null);
}
}

View File

@@ -67,7 +67,7 @@ public class DateExpParseInfo extends DateTimeParseInfo {
if (tz != null) {
cal.setTimeZone(tz);
}
return new IsoValue<Date>(type, cal.getTime(), null);
return new IsoValue<>(type, cal.getTime(), null);
}
@Override
@@ -99,6 +99,6 @@ public class DateExpParseInfo extends DateTimeParseInfo {
if (tz != null) {
cal.setTimeZone(tz);
}
return new IsoValue<Date>(type, cal.getTime(), null);
return new IsoValue<>(type, cal.getTime(), null);
}
}

View File

@@ -62,12 +62,12 @@ public class LlbinParseInfo extends FieldParseInfo {
byte[] binval = len == 0 ? new byte[0] : HexCodec.hexDecode(
new String(buf, pos + 2, len));
if (custom == null) {
return new IsoValue<byte[]>(type, binval, binval.length, null);
return new IsoValue<>(type, binval, binval.length, null);
} else if (custom instanceof CustomBinaryField) {
try {
T dec = ((CustomBinaryField<T>)custom).decodeBinaryField(buf, pos + 2, len);
return dec == null ? new IsoValue<byte[]>(type, binval, binval.length, null) :
new IsoValue<T>(type, dec, 0, custom);
return dec == null ? new IsoValue<>(type, binval, binval.length, null) :
new IsoValue<>(type, dec, 0, custom);
} catch (IndexOutOfBoundsException ex) {
throw new ParseException(String.format(
"Insufficient data for LLBIN field %d, pos %d (LEN states '%s')",
@@ -76,8 +76,8 @@ public class LlbinParseInfo extends FieldParseInfo {
} else {
try {
T dec = custom.decodeField(new String(buf, pos + 2, len));
return dec == null ? new IsoValue<byte[]>(type, binval, binval.length, null) :
new IsoValue<T>(type, dec, binval.length, custom);
return dec == null ? new IsoValue<>(type, binval, binval.length, null) :
new IsoValue<>(type, dec, binval.length, custom);
} catch (IndexOutOfBoundsException ex) {
throw new ParseException(String.format(
"Insufficient data for LLBIN field %d, pos %d (LEN states '%s')",
@@ -109,12 +109,12 @@ public class LlbinParseInfo extends FieldParseInfo {
byte[] _v = new byte[l];
System.arraycopy(buf, pos+1, _v, 0, l);
if (custom == null) {
return new IsoValue<byte[]>(type, _v, null);
return new IsoValue<>(type, _v, null);
} else if (custom instanceof CustomBinaryField) {
try {
T dec = ((CustomBinaryField<T>)custom).decodeBinaryField(buf, pos + 1, l);
return dec == null ? new IsoValue<byte[]>(type, _v, _v.length, null) :
new IsoValue<T>(type, dec, l, custom);
return dec == null ? new IsoValue<>(type, _v, _v.length, null) :
new IsoValue<>(type, dec, l, custom);
} catch (IndexOutOfBoundsException ex) {
throw new ParseException(String.format(
"Insufficient data for LLBIN field %d, pos %d length %d",
@@ -122,8 +122,8 @@ public class LlbinParseInfo extends FieldParseInfo {
}
} else {
T dec = custom.decodeField(HexCodec.hexEncode(_v, 0, _v.length));
return dec == null ? new IsoValue<byte[]>(type, _v, null) :
new IsoValue<T>(type, dec, custom);
return dec == null ? new IsoValue<>(type, _v, null) :
new IsoValue<>(type, dec, custom);
}
}

View File

@@ -59,13 +59,13 @@ public class LllbinParseInfo extends FieldParseInfo {
}
byte[] binval = l == 0 ? new byte[0] : HexCodec.hexDecode(new String(buf, pos + 3, l));
if (custom == null) {
return new IsoValue<byte[]>(type, binval, binval.length, null);
return new IsoValue<>(type, binval, binval.length, null);
} else if (custom instanceof CustomBinaryField) {
try {
T dec = ((CustomBinaryField<T>)custom).decodeBinaryField(
buf, pos + 3, l);
return dec == null ? new IsoValue<byte[]>(type, binval, binval.length, null) :
new IsoValue<T>(type, dec, 0, custom);
return dec == null ? new IsoValue<>(type, binval, binval.length, null) :
new IsoValue<>(type, dec, 0, custom);
} catch (IndexOutOfBoundsException ex) {
throw new ParseException(String.format(
"Insufficient data for LLLBIN field %d, pos %d", field, pos), pos);
@@ -74,8 +74,8 @@ public class LllbinParseInfo extends FieldParseInfo {
try {
T dec = custom.decodeField(
l == 0 ? "" : new String(buf, pos + 3, l));
return dec == null ? new IsoValue<byte[]>(type, binval, binval.length, null) :
new IsoValue<T>(type, dec, l, custom);
return dec == null ? new IsoValue<>(type, binval, binval.length, null) :
new IsoValue<>(type, dec, l, custom);
} catch (IndexOutOfBoundsException ex) {
throw new ParseException(String.format(
"Insufficient data for LLLBIN field %d, pos %d", field, pos), pos);
@@ -107,21 +107,21 @@ public class LllbinParseInfo extends FieldParseInfo {
byte[] _v = new byte[l];
System.arraycopy(buf, pos+2, _v, 0, l);
if (custom == null) {
return new IsoValue<byte[]>(type, _v, null);
return new IsoValue<>(type, _v, null);
} else if (custom instanceof CustomBinaryField) {
try {
T dec = ((CustomBinaryField<T>)custom).decodeBinaryField(
buf, pos + 2, l);
return dec == null ? new IsoValue<byte[]>(type, _v, _v.length, null) :
new IsoValue<T>(type, dec, l, custom);
return dec == null ? new IsoValue<>(type, _v, _v.length, null) :
new IsoValue<>(type, dec, l, custom);
} catch (IndexOutOfBoundsException ex) {
throw new ParseException(String.format(
"Insufficient data for LLLBIN field %d, pos %d", field, pos), pos);
}
} else {
T dec = custom.decodeField(HexCodec.hexEncode(_v, 0, _v.length));
return dec == null ? new IsoValue<byte[]>(type, _v, null) :
new IsoValue<T>(type, dec, custom);
return dec == null ? new IsoValue<>(type, _v, null) :
new IsoValue<>(type, dec, custom);
}
}