#78 fixed some smells

This commit is contained in:
Fabio Formosa
2022-11-08 22:59:07 +01:00
parent 6eededed2c
commit a4b0a1bafb
6 changed files with 27 additions and 30 deletions

View File

@@ -2,6 +2,9 @@ package it.fabioformosa.quartzmanager.api.common.config;
public class QuartzManagerPaths {
private QuartzManagerPaths(){
}
public static final String QUARTZ_MANAGER_BASE_CONTEXT_PATH = "/quartz-manager";
public static final String WEBJAR_PATH = "/quartz-manager-ui";

View File

@@ -8,15 +8,18 @@ import java.util.Date;
public class DateUtils {
static public Date fromLocalDateTimeToDate(LocalDateTime localDateTime){
private DateUtils(){
}
public static Date fromLocalDateTimeToDate(LocalDateTime localDateTime){
return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant().truncatedTo(ChronoUnit.MILLIS));
}
static public LocalDateTime fromDateToLocalDateTime(Date date) {
public static LocalDateTime fromDateToLocalDateTime(Date date) {
return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().truncatedTo(ChronoUnit.MILLIS);
}
static public Date addHoursToNow(long hours){
public static Date addHoursToNow(long hours){
return DateUtils.fromLocalDateTimeToDate(LocalDateTime.now().plus(Duration.ofHours(hours)));
}

View File

@@ -16,11 +16,11 @@ public class Try<R> {
return success;
}
public static <R> Try success(R r){
public static <R> Try<R> success(R r){
return new Try<>(null, r);
}
public static <ExceptionType> Try failure(Throwable e){
public static <R> Try<R> failure(Throwable e){
return new Try<>(e, null);
}