Skip to content

Commit 8bec60f

Browse files
authored
Merge pull request #69 from avaje/feature/javalin-4x
Support for Javalin 4.x API
2 parents ae08664 + bb8e0d9 commit 8bec60f

File tree

7 files changed

+84
-74
lines changed

7 files changed

+84
-74
lines changed

http-api/src/main/java/io/avaje/http/api/PathTypeConversion.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
package io.avaje.http.api;
22

33
import java.math.BigDecimal;
4-
import java.time.Instant;
5-
import java.time.LocalDate;
6-
import java.time.LocalDateTime;
7-
import java.time.LocalTime;
8-
import java.time.OffsetDateTime;
4+
import java.time.*;
95
import java.util.UUID;
106

117
/**
@@ -15,6 +11,17 @@
1511
*/
1612
public class PathTypeConversion {
1713

14+
/**
15+
* Return the value if non-null and otherwise the default value.
16+
*
17+
* @param value The value to return if non-null
18+
* @param defaultValue The default value to return
19+
* @return The value if non-null and otherwise the default value.
20+
*/
21+
public static String withDefault(String value, String defaultValue) {
22+
return value != null ? value : defaultValue;
23+
}
24+
1825
/**
1926
* Check for null for a required property throwing RequiredArgumentException
2027
* if the value is null.

0 commit comments

Comments
 (0)