クラス NumberConvertUtils


  • public class NumberConvertUtils
    extends Object
    数値の変換用ユーティリティです。
    作成者:
    T.TSUCHIE
    • コンストラクタの詳細

      • NumberConvertUtils

        public NumberConvertUtils()
    • メソッドの詳細

      • incrementNumber

        public static Number incrementNumber​(Class<?> type,
                                             Object value)
        数値を変換しかつインクリメントする。 値がnullのときはnullを返す。
        パラメータ:
        type - 変換後のクラスタイプ
        value - 変換対象の値
        戻り値:
        インクリメントした値。引数valueがnullのときはnullを返す。
        例外:
        IllegalArgumentException - typeがサポートしていない数値型の場合。
      • convertNumber

        public static Number convertNumber​(Class<?> type,
                                           Object value)
        数値に変換する。
        パラメータ:
        type - 変換後のクラスタイプ
        value - 変換対象の値
        戻り値:
        変換した値。引数valueがnullのときはnullを返す。
        例外:
        IllegalArgumentException - typeがサポートしていない数値型の場合。
      • toPrimitiveInteger

        public static Integer toPrimitiveInteger​(Object value)
      • toPrimitiveInteger

        public static int toPrimitiveInteger​(String value)
      • toLong

        public static Long toLong​(Object value)
      • toLong

        public static Long toLong​(String value)
      • toPrimitiveLong

        public static Long toPrimitiveLong​(Object value)
      • toPrimitiveLong

        public static long toPrimitiveLong​(String value)
      • toShort

        public static Short toShort​(Object value)
      • toShort

        public static Short toShort​(String value)
      • toPrimitiveShort

        public static Short toPrimitiveShort​(Object value)
      • toPrimitiveShort

        public static short toPrimitiveShort​(String value)