generated from pagopa/template-java-spring-microservice
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
100 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package it.gov.pagopa.standinmanager.util; | ||
|
||
import java.time.LocalDate; | ||
import java.time.format.DateTimeFormatter; | ||
import java.util.Optional; | ||
|
||
public class Util { | ||
|
||
public static String format(LocalDate d) { | ||
return d.format(DateTimeFormatter.ISO_DATE); | ||
} | ||
|
||
/** | ||
* @param value value to deNullify. | ||
* @return return empty string if value is null | ||
*/ | ||
public static String deNull(String value) { | ||
return Optional.ofNullable(value).orElse(""); | ||
} | ||
|
||
/** | ||
* @param value value to deNullify. | ||
* @return return empty string if value is null | ||
*/ | ||
public static String deNull(Object value) { | ||
return Optional.ofNullable(value).orElse("").toString(); | ||
} | ||
|
||
/** | ||
* @param value value to deNullify. | ||
* @return return false if value is null | ||
*/ | ||
public static Boolean deNull(Boolean value) { | ||
return Optional.ofNullable(value).orElse(false); | ||
} | ||
|
||
} |