Skip to content

Commit 70d97af

Browse files
committed
Simplified primitive boxing, parsing and formatting calls
1 parent 4e6a5e5 commit 70d97af

File tree

13 files changed

+23
-24
lines changed

13 files changed

+23
-24
lines changed

quickfixj-codegenerator/src/main/java/org/quickfixj/codegenerator/MessageCodeGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public class MessageCodeGenerator {
6262
private static final long SERIAL_UID = 20050617;
6363

6464
// The String representation of the UID
65-
private static final String SERIAL_UID_STR = String.valueOf(SERIAL_UID);
65+
private static final String SERIAL_UID_STR = Long.toString(SERIAL_UID);
6666

6767
// The name of the param in the .xsl files to pass the serialVersionUID
6868
private static final String XSLPARAM_SERIAL_UID = "serialVersionUID";

quickfixj-core/src/main/java/quickfix/BusinessRejectReasonText.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public class BusinessRejectReasonText extends BusinessRejectReason {
5050
* @return the description or null if there isn't a description for that reason
5151
*/
5252
public static String getMessage(int rejectReason) {
53-
return rejectReasonText.get(Integer.valueOf(rejectReason));
53+
return rejectReasonText.get(rejectReason);
5454
}
5555

5656
}

quickfixj-core/src/main/java/quickfix/DataDictionary.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ private void checkMsgType(String msgType) {
669669

670670
// / Check if field tag number is defined in spec.
671671
void checkValidTagNumber(Field<?> field) {
672-
if (!fields.contains(Integer.valueOf(field.getTag()))) {
672+
if (!fields.contains(field.getTag())) {
673673
throw new FieldException(SessionRejectReason.INVALID_TAG_NUMBER, field.getField());
674674
}
675675
}
@@ -687,7 +687,7 @@ void checkField(Field<?> field, String msgType, boolean message) {
687687
}
688688

689689
if (fail) {
690-
if (fields.contains(Integer.valueOf(field.getTag()))) {
690+
if (fields.contains(field.getTag())) {
691691
throw new FieldException(SessionRejectReason.TAG_NOT_DEFINED_FOR_THIS_MESSAGE_TYPE, field.getField());
692692
} else {
693693
throw new FieldException(SessionRejectReason.INVALID_TAG_NUMBER, field.getField());

quickfixj-core/src/test/java/quickfix/mina/SingleThreadedEventHandlingStrategyTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ private SocketAcceptor createAcceptor(int i) throws ConfigError {
259259
acceptorProperties.put("ConnectionType", "acceptor");
260260
acceptorProperties.put("HeartBtInt", "5");
261261
acceptorProperties.put("SocketAcceptHost", "localhost");
262-
acceptorProperties.put("SocketAcceptPort", String.valueOf(9999 + i) );
262+
acceptorProperties.put("SocketAcceptPort", Integer.toString(9999 + i));
263263
acceptorProperties.put("ReconnectInterval", "2");
264264
acceptorProperties.put("StartTime", "00:00:00");
265265
acceptorProperties.put("EndTime", "00:00:00");
@@ -284,7 +284,7 @@ public SocketInitiator createInitiator(int i) throws ConfigError {
284284
acceptorProperties.put("ConnectionType", "initiator");
285285
acceptorProperties.put("HeartBtInt", "5");
286286
acceptorProperties.put("SocketConnectHost", "localhost");
287-
acceptorProperties.put("SocketConnectPort", String.valueOf(9999 + i) );
287+
acceptorProperties.put("SocketConnectPort", Integer.toString(9999 + i));
288288
acceptorProperties.put("ReconnectInterval", "2");
289289
acceptorProperties.put("StartTime", "00:00:00");
290290
acceptorProperties.put("EndTime", "00:00:00");

quickfixj-core/src/test/java/quickfix/test/acceptance/TestConnection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public void sendMessage(int clientId, String message) throws IOException {
6262

6363
private TestIoHandler getIoHandler(int clientId) {
6464
synchronized (ioHandlers) {
65-
return ioHandlers.get(Integer.valueOf(clientId));
65+
return ioHandlers.get(clientId);
6666
}
6767
}
6868

quickfixj-dictgenerator/src/main/java/org/quickfixj/dictgenerator/Generator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,8 @@ public static void main(String[] args) throws Exception {
294294
System.exit(1);
295295
return;
296296
}
297-
int major = Integer.valueOf(args[1]);
298-
int minor = Integer.valueOf(args[2]);
297+
int major = Integer.parseInt(args[1]);
298+
int minor = Integer.parseInt(args[2]);
299299

300300
new Generator(repository, major, minor).generate();
301301
}

quickfixj-examples/banzai/src/main/java/quickfix/examples/banzai/BanzaiApplication.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ private void executionReport(Message message, SessionID sessionID) throws FieldN
219219

220220
if (fillSize.compareTo(BigDecimal.ZERO) > 0) {
221221
order.setOpen(order.getOpen() - (int) Double.parseDouble(fillSize.toPlainString()));
222-
order.setExecuted(new Integer(message.getString(CumQty.FIELD)));
223-
order.setAvgPx(new Double(message.getString(AvgPx.FIELD)));
222+
order.setExecuted(Integer.parseInt(message.getString(CumQty.FIELD)));
223+
order.setAvgPx(Double.parseDouble(message.getString(AvgPx.FIELD)));
224224
}
225225

226226
OrdStatus ordStatus = (OrdStatus) message.getField(new OrdStatus());
@@ -253,7 +253,7 @@ private void executionReport(Message message, SessionID sessionID) throws FieldN
253253
execution.setSymbol(message.getField(new Symbol()).getValue());
254254
execution.setQuantity(fillSize.intValue());
255255
if (message.isSetField(LastPx.FIELD)) {
256-
execution.setPrice(new Double(message.getString(LastPx.FIELD)));
256+
execution.setPrice(Double.parseDouble(message.getString(LastPx.FIELD)));
257257
}
258258
Side side = (Side) message.getField(new Side());
259259
execution.setSide(FIXSideToSide(side));

quickfixj-examples/banzai/src/main/java/quickfix/examples/banzai/Execution.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class Execution {
2929
private static int nextID = 1;
3030

3131
public Execution() {
32-
ID = Integer.valueOf(nextID++).toString();
32+
ID = Integer.toString(nextID++);
3333
}
3434

3535
public Execution(String ID) {

quickfixj-examples/banzai/src/main/java/quickfix/examples/banzai/ExecutionTableModel.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public Execution getExchangeExecution(String exchangeID) {
6969
}
7070

7171
public Execution getExecution(int row) {
72-
return rowToExecution.get(Integer.valueOf(row));
72+
return rowToExecution.get(row);
7373
}
7474

7575
public void setValueAt(Object value, int rowIndex, int columnIndex) { }
@@ -91,7 +91,7 @@ public String getColumnName(int columnIndex) {
9191
}
9292

9393
public Object getValueAt(int rowIndex, int columnIndex) {
94-
Execution execution = rowToExecution.get(Integer.valueOf(rowIndex));
94+
Execution execution = rowToExecution.get(rowIndex);
9595

9696
switch (columnIndex) {
9797
case SYMBOL:

quickfixj-examples/banzai/src/main/java/quickfix/examples/banzai/Order.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public Object clone() {
6060
}
6161

6262
public String generateID() {
63-
return Long.valueOf(System.currentTimeMillis() + (nextID++)).toString();
63+
return Long.toString(System.currentTimeMillis() + (nextID++));
6464
}
6565

6666
public SessionID getSessionID() {
@@ -139,7 +139,7 @@ public void setLimit(String limit) {
139139
if (limit == null || limit.equals("")) {
140140
this.limit = null;
141141
} else {
142-
this.limit = new Double(limit);
142+
this.limit = Double.parseDouble(limit);
143143
}
144144
}
145145

@@ -155,7 +155,7 @@ public void setStop(String stop) {
155155
if (stop == null || stop.equals("")) {
156156
this.stop = null;
157157
} else {
158-
this.stop = new Double(stop);
158+
this.stop = Double.parseDouble(stop);
159159
}
160160
}
161161

0 commit comments

Comments
 (0)