-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove redundancy * Update timestamp when entry is fetched #3074 * Unused import * Move to own preferences class * Checkstyle is a pain in the ***
- Loading branch information
1 parent
2971f29
commit 451d829
Showing
8 changed files
with
82 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/main/java/org/jabref/logic/preferences/TimestampPreferences.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package org.jabref.logic.preferences; | ||
|
||
import java.time.LocalDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
public class TimestampPreferences { | ||
private final boolean useTimestamps; | ||
private final boolean useModifiedTimestamp; | ||
private final String timestampField; | ||
private final String timestampFormat; | ||
private final boolean overwriteTimestamp; | ||
|
||
public TimestampPreferences(boolean useTimestamps, boolean useModifiedTimestamp, String timestampField, String timestampFormat, boolean overwriteTimestamp) { | ||
this.useTimestamps = useTimestamps; | ||
this.useModifiedTimestamp = useModifiedTimestamp; | ||
this.timestampField = timestampField; | ||
this.timestampFormat = timestampFormat; | ||
this.overwriteTimestamp = overwriteTimestamp; | ||
} | ||
|
||
public boolean includeCreatedTimestamp() { | ||
return useTimestamps; | ||
} | ||
|
||
public boolean includeModifiedTimestamp() { | ||
return useModifiedTimestamp; | ||
} | ||
|
||
public String getTimestampField() { | ||
return timestampField; | ||
} | ||
|
||
public String getTimestampFormat() { | ||
return timestampFormat; | ||
} | ||
|
||
public boolean overwriteTimestamp() { | ||
return overwriteTimestamp; | ||
} | ||
|
||
public boolean includeTimestamps() { | ||
return useTimestamps && useModifiedTimestamp; | ||
} | ||
|
||
public String now() { | ||
String timeStampFormat = timestampFormat; | ||
return DateTimeFormatter.ofPattern(timeStampFormat).format(LocalDateTime.now()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters