mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 16:37:13 +02:00
Refactor Guava functional methods to use lambdas
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=177027488
This commit is contained in:
parent
2ae496bfce
commit
bbe2584da4
47 changed files with 478 additions and 647 deletions
|
@ -19,7 +19,6 @@ import static google.registry.model.ofy.ObjectifyService.ofy;
|
|||
import static google.registry.util.DateTimeUtils.isBeforeOrAt;
|
||||
|
||||
import com.google.common.collect.ImmutableSetMultimap;
|
||||
import com.googlecode.objectify.Work;
|
||||
import google.registry.config.RegistryConfig.Config;
|
||||
import google.registry.model.common.Cursor;
|
||||
import google.registry.model.common.Cursor.CursorType;
|
||||
|
@ -107,16 +106,16 @@ public final class PendingDepositChecker {
|
|||
final Registry registry,
|
||||
final CursorType cursorType,
|
||||
final DateTime initialValue) {
|
||||
return ofy().transact(new Work<DateTime>() {
|
||||
@Override
|
||||
public DateTime run() {
|
||||
Cursor cursor = ofy().load().key(Cursor.createKey(cursorType, registry)).now();
|
||||
if (cursor != null) {
|
||||
return cursor.getCursorTime();
|
||||
}
|
||||
ofy().save().entity(Cursor.create(cursorType, initialValue, registry));
|
||||
return initialValue;
|
||||
}});
|
||||
return ofy()
|
||||
.transact(
|
||||
() -> {
|
||||
Cursor cursor = ofy().load().key(Cursor.createKey(cursorType, registry)).now();
|
||||
if (cursor != null) {
|
||||
return cursor.getCursorTime();
|
||||
}
|
||||
ofy().save().entity(Cursor.create(cursorType, initialValue, registry));
|
||||
return initialValue;
|
||||
});
|
||||
}
|
||||
|
||||
private static DateTime advanceToDayOfWeek(DateTime date, int dayOfWeek) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue