Class PrimitiveValueConverter


  • public class PrimitiveValueConverter
    extends java.lang.Object
    Converts value to specific primitive type.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String adjustDecimalSeparatorToSystem​(java.lang.String number)  
      static java.text.DecimalFormatSymbols getDecimalFormatSymbols()
      Gets DecimalFormatSymbols of OS.
      static java.lang.Boolean toBoolean​(java.lang.Object value, java.lang.Boolean defaultValue)  
      static java.lang.Boolean toBoolean​(java.lang.Object value, java.lang.Boolean defaultValue, java.util.function.Function<java.lang.Object,​java.lang.Boolean> converter)  
      static java.lang.Float toFloat​(java.lang.Object value)  
      static java.lang.Float toFloat​(java.lang.Object value, java.lang.Float defaultValue)  
      static java.lang.Integer toInteger​(java.lang.Object value, java.lang.Integer defaultValue)  
      static java.lang.Number toNumber​(java.lang.Object value)  
      static java.lang.Number toNumber​(java.lang.Object value, Type type)  
      static java.lang.Double toReal​(java.lang.Object value)  
      static java.lang.Double toReal​(java.lang.Object value, java.lang.Double defaultValue)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PrimitiveValueConverter

        public PrimitiveValueConverter()
    • Method Detail

      • toBoolean

        @CheckForNull
        public static java.lang.Boolean toBoolean​(@CheckForNull
                                                  java.lang.Object value,
                                                  @CheckForNull
                                                  java.lang.Boolean defaultValue)
      • toBoolean

        @CheckForNull
        public static java.lang.Boolean toBoolean​(@CheckForNull
                                                  java.lang.Object value,
                                                  @CheckForNull
                                                  java.lang.Boolean defaultValue,
                                                  java.util.function.Function<java.lang.Object,​java.lang.Boolean> converter)
      • toReal

        @CheckForNull
        public static java.lang.Double toReal​(java.lang.Object value)
                                       throws java.lang.NumberFormatException
        Throws:
        java.lang.NumberFormatException
      • toReal

        @CheckForNull
        public static java.lang.Double toReal​(@CheckForNull
                                              java.lang.Object value,
                                              @CheckForNull
                                              java.lang.Double defaultValue)
                                       throws java.lang.NumberFormatException
        Throws:
        java.lang.NumberFormatException
      • toFloat

        public static java.lang.Float toFloat​(java.lang.Object value)
                                       throws java.lang.NumberFormatException
        Throws:
        java.lang.NumberFormatException
      • toFloat

        @CheckForNull
        public static java.lang.Float toFloat​(@CheckForNull
                                              java.lang.Object value,
                                              @CheckForNull
                                              java.lang.Float defaultValue)
                                       throws java.lang.NumberFormatException
        Throws:
        java.lang.NumberFormatException
      • toInteger

        @CheckForNull
        public static java.lang.Integer toInteger​(@CheckForNull
                                                  java.lang.Object value,
                                                  @CheckForNull
                                                  java.lang.Integer defaultValue)
                                           throws java.lang.NumberFormatException
        Throws:
        java.lang.NumberFormatException
      • toNumber

        @CheckForNull
        public static java.lang.Number toNumber​(java.lang.Object value,
                                                @CheckForNull
                                                Type type)
      • toNumber

        public static java.lang.Number toNumber​(java.lang.Object value)
                                         throws java.lang.NumberFormatException
        Throws:
        java.lang.NumberFormatException
      • adjustDecimalSeparatorToSystem

        public static java.lang.String adjustDecimalSeparatorToSystem​(java.lang.String number)
      • getDecimalFormatSymbols

        public static java.text.DecimalFormatSymbols getDecimalFormatSymbols()
        Gets DecimalFormatSymbols of OS. DecimalFormatSymbols is get on separate process because HOST locale provider should be used to get OS specific data, but the tool uses different one.
        Returns:
        OS DecimalFormatSymbols configuration.