Class ConfigurationTypeHelper


  • public class ConfigurationTypeHelper
    extends Object
    • Constructor Detail

      • ConfigurationTypeHelper

        public ConfigurationTypeHelper()
    • Method Detail

      • getFixedMemoryAsBytes

        public static long getFixedMemoryAsBytes​(String str)
        Interprets a string specifying bytes. A bytes type is specified as a long integer followed by an optional B (bytes), K (KB), M (MB), or G (GB).
        Parameters:
        str - String value
        Returns:
        interpreted memory size in bytes
      • getMemoryAsBytes

        public static long getMemoryAsBytes​(String str)
        Interprets a string specifying a Memory type which is specified as a long integer followed by an optional B (bytes), K (KB), M (MB), G (GB) or % (percentage).
        Parameters:
        str - String value
        Returns:
        interpreted memory size in bytes
      • getTimeInMillis

        public static long getTimeInMillis​(String str)
        Interprets a string specifying a time duration. A time duration is specified as a long integer followed by an optional d (days), h (hours), m (minutes), s (seconds), or ms (milliseconds). A value without a unit is interpreted as seconds.
        Parameters:
        str - string value
        Returns:
        interpreted time duration in milliseconds
      • getFraction

        public static double getFraction​(String str)
        Interprets a string specifying a fraction. A fraction is specified as a double. An optional % at the end signifies a percentage.
        Parameters:
        str - string value
        Returns:
        interpreted fraction as a decimal value
      • getClassInstance

        public static <T> T getClassInstance​(String context,
                                             String clazzName,
                                             Class<T> base,
                                             T defaultInstance)
        Loads a class in the given classloader context, suppressing any exceptions, and optionally providing a default instance to use.
        Parameters:
        context - the per-table context, can be null
        clazzName - the name of the class to load
        base - the type of the class
        defaultInstance - a default instance if the class cannot be loaded
        Returns:
        a new instance of the class, or the defaultInstance
      • getNumThreads

        public static int getNumThreads​(String threads)
        Get the number of threads from string property. If the value ends with C, then it will be multiplied by the number of cores.