- Preconditions.checkState(DateAndTime.PATTERN_CONSTANTS.size() == 1);
- String formattedDateTime = DATE_FORMATTER.format(loginTime);
-
- Matcher matcher = DATE_TIME_PATTERN.matcher(formattedDateTime);
- Preconditions.checkState(matcher.matches(), "Formatted datetime %s does not match pattern %s",
- formattedDateTime, DATE_TIME_PATTERN);
- builder.setLoginTime(new DateAndTime(formattedDateTime));
-
- builder.setInBadRpcs(new ZeroBasedCounter32(inRpcFail));
- builder.setInRpcs(new ZeroBasedCounter32(inRpcSuccess));
- builder.setOutRpcErrors(new ZeroBasedCounter32(outRpcError));
-
- builder.setUsername(header.getUserName());
- builder.setTransport(getTransportForString(header.getTransport()));
-
- builder.setOutNotifications(new ZeroBasedCounter32(outNotification));
-
- builder.setKey(new SessionKey(getSessionId()));
-
- Session1Builder builder1 = new Session1Builder();
- builder1.setSessionIdentifier(header.getSessionIdentifier());
- builder.addAugmentation(Session1.class, builder1.build());
-
- return builder.build();
+ final String formattedDateTime = DATE_FORMATTER.format(loginTime);
+ checkState(DATE_TIME_PATTERN.matcher(formattedDateTime).matches(),
+ "Formatted datetime %s does not match pattern %s", formattedDateTime, DATE_TIME_PATTERN);
+
+ return builder
+ .setLoginTime(new DateAndTime(formattedDateTime))
+ .setInBadRpcs(new ZeroBasedCounter32(Uint32.valueOf(inRpcFail)))
+ .setInRpcs(new ZeroBasedCounter32(Uint32.valueOf(inRpcSuccess)))
+ .setOutRpcErrors(new ZeroBasedCounter32(Uint32.valueOf(outRpcError)))
+ .setUsername(header.getUserName())
+ .setTransport(getTransportForString(header.getTransport()))
+ .setOutNotifications(new ZeroBasedCounter32(Uint32.valueOf(outNotification)))
+ .addAugmentation(new Session1Builder().setSessionIdentifier(header.getSessionIdentifier()).build())
+ .build();