Class PathTypeConversion

java.lang.Object
io.avaje.http.api.PathTypeConversion

public final class PathTypeConversion extends Object
Helper type conversion methods.

These methods are intended to be used by APT source generators.

  • Method Details

    • withDefault

      public static String withDefault(String value, String defaultValue)
      Return the value if non-null and otherwise the default value.
      Parameters:
      value - The value to return if non-null
      defaultValue - The default value to return
      Returns:
      The value if non-null and otherwise the default value.
    • withDefault

      public static List<String> withDefault(List<String> value, List<String> defaultValue)
    • checkNull

      public static String checkNull(String value, String property)
      Check for null for a required property throwing RequiredArgumentException if the value is null.
      Returns:
      The value being checked
    • list

      public static <T> List<T> list(Function<String,T> func, List<String> params)
    • set

      public static <T> Set<T> set(Function<String,T> func, List<String> params)
    • asInt

      public static int asInt(String value)
      Convert to int.
    • asEnum

      public static <T> Enum asEnum(Class<T> clazz, String value)
      Convert to enum.
    • asLong

      public static long asLong(String value)
      Convert to long.
    • asDouble

      public static double asDouble(String value)
      Convert to double.
    • asFloat

      public static float asFloat(String value)
      Convert to float.
    • asBoolean

      public static boolean asBoolean(String value)
      Convert to boolean.
    • asBool

      public static boolean asBool(String value)
      Convert to boolean.
    • asBigInteger

      public static BigInteger asBigInteger(String value)
      Convert to BigInteger (not nullable).
    • asBigDecimal

      public static BigDecimal asBigDecimal(String value)
      Convert to BigDecimal (not nullable).
    • asLocalDate

      public static LocalDate asLocalDate(String value)
      Convert to LocalDate (not nullable).
    • asLocalTime

      public static LocalTime asLocalTime(String value)
      Convert to LocalTime (not nullable).
    • asInstant

      public static Instant asInstant(String value)
      Convert to Instant (not nullable).
    • asOffsetDateTime

      public static OffsetDateTime asOffsetDateTime(String value)
      Convert to OffsetDateTime (not nullable).
    • asLocalDateTime

      public static LocalDateTime asLocalDateTime(String value)
      Convert to LocalDateTime (not nullable).
    • asUUID

      public static UUID asUUID(String value)
      Convert to UUID (not nullable).
    • asInteger

      public static Integer asInteger(String value)
      Convert to Integer (not nullable).
    • toInteger

      public static Integer toInteger(String value)
      Convert to Integer (allowing nulls).
    • toLong

      public static Long toLong(String value)
      Convert to Long (allowing nulls).
    • toDouble

      public static Double toDouble(String value)
      Convert to Double (allowing nulls).
    • toFloat

      public static Float toFloat(String value)
      Convert to Float (allowing nulls).
    • toBigDecimal

      public static BigDecimal toBigDecimal(String value)
      Convert to BigDecimal (allowing nulls).
    • toBigInteger

      public static BigInteger toBigInteger(String value)
      Convert to BigInteger (allowing nulls).
    • toBoolean

      public static Boolean toBoolean(String value)
      Convert to Boolean (allowing nulls).
    • toUUID

      public static UUID toUUID(String value)
      Convert to UUID (allowing nulls).
    • toLocalDate

      public static LocalDate toLocalDate(String value)
      Convert to LocalDate (allowing nulls).
    • toLocalTime

      public static LocalTime toLocalTime(String value)
      Convert to LocalTime (allowing nulls).
    • toInstant

      public static Instant toInstant(String value)
      Convert to Instant (allowing nulls).
    • toOffsetDateTime

      public static OffsetDateTime toOffsetDateTime(String value)
      Convert to OffsetDateTime (allowing nulls).
    • toLocalDateTime

      public static LocalDateTime toLocalDateTime(String value)
      Convert to LocalDateTime (allowing nulls).