Clean up some code quality issues

This removes some qualifiers that aren't necessary (e.g. public/abstract on interfaces, private on enum constructors, final on private methods, static on nested interfaces/enums), uses Java 8 lambdas and features where that's an improvement

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177182945
This commit is contained in:
mcilwain 2017-11-28 10:35:57 -08:00 committed by jianglai
parent 0935ba6450
commit e2db3f914e
109 changed files with 286 additions and 379 deletions

View file

@ -509,9 +509,7 @@ public class DomainFlowUtils {
// If the resultant autorenew poll message would have no poll messages to deliver, then just
// delete it. Otherwise save it with the new end time.
if (isAtOrAfter(updatedAutorenewPollMessage.getEventTime(), newEndTime)) {
if (autorenewPollMessage.isPresent()) {
ofy().delete().entity(autorenewPollMessage.get());
}
autorenewPollMessage.ifPresent(autorenew -> ofy().delete().entity(autorenew));
} else {
ofy().save().entity(updatedAutorenewPollMessage);
}

View file

@ -207,9 +207,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
autorenewEvent,
gainingClientPollMessage,
gainingClientAutorenewPollMessage);
if (billingEvent.isPresent()) {
entitiesToSave.add(billingEvent.get());
}
billingEvent.ifPresent(entitiesToSave::add);
ofy().save().entities(entitiesToSave.build());
// Delete the billing event and poll messages that were written in case the transfer would have
// been implicitly server approved.

View file

@ -197,9 +197,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
existingDomain,
trid,
gainingClientId,
(feesAndCredits.isPresent())
? Optional.of(feesAndCredits.get().getTotalCost())
: Optional.empty(),
feesAndCredits.map(FeesAndCredits::getTotalCost),
now);
// Create the transfer data that represents the pending transfer.
TransferData pendingTransferData =

View file

@ -193,9 +193,7 @@ public final class DomainUpdateFlow implements TransactionalFlow {
entitiesToSave.add(newDomain, historyEntry);
Optional<BillingEvent.OneTime> statusUpdateBillingEvent =
createBillingEventForStatusUpdates(existingDomain, newDomain, historyEntry, now);
if (statusUpdateBillingEvent.isPresent()) {
entitiesToSave.add(statusUpdateBillingEvent.get());
}
statusUpdateBillingEvent.ifPresent(entitiesToSave::add);
EntityChanges entityChanges =
customLogic.beforeSave(
BeforeSaveParameters.newBuilder()