Class PropsUtil


  • public class PropsUtil
    extends Object
    Utility class to handle properties. If the value is null, or if there is a parser error, the defaultMissing value will be returned.
    • Constructor Detail

      • PropsUtil

        public PropsUtil()
    • Method Detail

      • getBoolean

        public static Boolean getBoolean​(String v,
                                         Boolean defaultMissing)
        Parses v. If there is a problem, this returns defaultMissing.
        Parameters:
        v - string to parse
        defaultMissing - value to return if value is null or unparseable
        Returns:
        parsed value
      • getInt

        public static Integer getInt​(String v,
                                     Integer defaultMissing)
        Parses v. If there is a problem, this returns defaultMissing.
        Parameters:
        v - string to parse
        defaultMissing - value to return if value is null or unparseable
        Returns:
        parsed value
      • getLong

        public static Long getLong​(String v,
                                   Long defaultMissing)
        Parses v. If there is a problem, this returns defaultMissing.
        Parameters:
        v - string to parse
        defaultMissing - value to return if value is null or unparseable
        Returns:
        parsed value
      • getFile

        @Deprecated
        public static File getFile​(String v,
                                   File defaultMissing)
        Deprecated.
        Parses v. If there is a problem, this returns defaultMissing.
        Parameters:
        v - string to parse
        defaultMissing - value to return if value is null or unparseable
        Returns:
        parsed value
        See Also:
        getPath(String, Path)
      • getString

        public static String getString​(String v,
                                       String defaultMissing)
        Parses v. If v is null, this returns defaultMissing.
        Parameters:
        v - string to parse
        defaultMissing - value to return if value is null
        Returns:
        parsed value
      • getPath

        public static Path getPath​(String v,
                                   Path defaultMissing)
        Parses v. If there is a problem, this returns defaultMissing.
        Parameters:
        v - string to parse
        defaultMissing - value to return if value is null or unparseable
        Returns:
        parsed value
        See Also:
        getPath(String, Path)