mirror of
https://github.com/google/nomulus.git
synced 2025-05-16 09:27:16 +02:00
Add an auto update time field to the Cursor entity
Also adjusts the nomulus list_cursors command to output the value of this field. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=206646117
This commit is contained in:
parent
3941249dfe
commit
f614044681
6 changed files with 62 additions and 14 deletions
|
@ -18,6 +18,7 @@ import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
|||
|
||||
import google.registry.model.translators.UpdateAutoTimestampTranslatorFactory;
|
||||
import java.util.Optional;
|
||||
import javax.annotation.Nullable;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
|
@ -29,12 +30,12 @@ public class UpdateAutoTimestamp extends ImmutableObject {
|
|||
|
||||
DateTime timestamp;
|
||||
|
||||
/** Returns the timestamp, or {@link #START_OF_TIME} if it's null. */
|
||||
/** Returns the timestamp, or {@link START_OF_TIME} if it's null. */
|
||||
public DateTime getTimestamp() {
|
||||
return Optional.ofNullable(timestamp).orElse(START_OF_TIME);
|
||||
}
|
||||
|
||||
public static UpdateAutoTimestamp create(DateTime timestamp) {
|
||||
public static UpdateAutoTimestamp create(@Nullable DateTime timestamp) {
|
||||
UpdateAutoTimestamp instance = new UpdateAutoTimestamp();
|
||||
instance.timestamp = timestamp;
|
||||
return instance;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue