Class ConverterUtil

java.lang.Object
com.github.hypfvieh.util.ConverterUtil

public final class ConverterUtil extends Object
Utility class for converting types (e.g. String to Integer).
Since:
v1.0 - 2016-07-08
Author:
hypfvieh
  • Method Details

    • strToInt

      public static Integer strToInt(String _str, Integer _default)
      Convert given String to Integer, returns _default if String is not an integer.
      Parameters:
      _str -
      _default -
      Returns:
      _str as Integer or _default value
    • strToInt

      public static Integer strToInt(String _str)
      Convert given String to Integer, returns null if String is not an integer.
      Parameters:
      _str -
      Returns:
      _str as Integer or null
    • strToBool

      public static boolean strToBool(String _str)
      Returns true if string matches certain boolean values.
      Parameters:
      _str -
      Returns:
    • toProperties

      public static Properties toProperties(Map<?,?> _map)
      Convertes a map to a Properties object.
      Parameters:
      _map -
      Returns:
      Properties object
    • toLocalDateTime

      public static LocalDateTime toLocalDateTime(Date _date)
      Converts a Date to a LocalDateTime using the default timezone.
      Parameters:
      _date - date to convert
      Returns:
      LocalDateTime or null if input null
    • toLocalDate

      public static LocalDate toLocalDate(Date _date)
      Converts a Date to a LocalDate using the default timezone.
      Parameters:
      _date - date to convert
      Returns:
      LocalDate or null if input null
    • toLocalTime

      public static LocalTime toLocalTime(Date _date)
      Converts a Date to a LocalTime using the default timezone.
      Parameters:
      _date - date to convert
      Returns:
      LocalTime or null if input null