public class ConversionUtilities extends Object
| Constructor and Description |
|---|
ConversionUtilities() |
| Modifier and Type | Method and Description |
|---|---|
static BigDecimal |
convertToBigDecimal(String string) |
static BigInteger |
convertToBigInteger(String string) |
static Boolean |
convertToBoolean(String string) |
static Date |
convertToDate(String value) |
static Double |
convertToDouble(Object value) |
static Double |
convertToDouble(String string) |
static List<Double> |
convertToDoubleList(List<String> values) |
static Float |
convertToFloat(String string) |
static List<Float> |
convertToFloatList(List<String> values) |
static Integer |
convertToInteger(Object value) |
static Integer |
convertToInteger(String string) |
static List<Integer> |
convertToIntegerList(List<String> values) |
static Long |
convertToLong(String string) |
static List<Long> |
convertToLongList(List<String> values) |
static Number |
convertToNumber(String string,
int types)
Converts a string to an number given a set of possible types to convert to.
|
static Object |
convertToObject(String string)
Converts a string to an object to an integer, double, boolean or string.
|
static Object |
convertToObject(String string,
int types)
Converts a string to an object given a set of possible types to convert to.
|
static List<Object> |
convertToObjectList(List<String> values,
int type) |
static List<Object> |
convertToObjectList(List<String> values,
int[] types) |
static Short |
convertToShort(String string) |
static List<Short> |
convertToShortList(List<String> values) |
static String |
convertToString(Object value) |
static String |
convertToString(String value) |
static int |
getDataType(String string) |
static List<Integer> |
getDataTypes(List<String> strings) |
static List<Integer> |
getDataTypes(List<String> strings,
List<Integer> currentDatatypes) |
static int[] |
getDataTypes(String[] strings) |
static int[] |
getDataTypes(String[] strings,
int[] currentDatatypes) |
static List<String> |
getTypesNames(int types) |
public static final Object convertToObject(String string)
string - the string to be convertedpublic static final Object convertToObject(String string, int types) throws ConversionException
string - the string to be convertedtypes - possible types to which to convertConversionException - if the string can not be converted to one of the possible typespublic static final Number convertToNumber(String string, int types) throws ConversionException
string - the string to be convertedtypes - types to convertConversionException - if conversion to all given types failspublic static final BigDecimal convertToBigDecimal(String string) throws ConversionException
ConversionExceptionpublic static final BigInteger convertToBigInteger(String string) throws ConversionException
ConversionExceptionpublic static final Double convertToDouble(String string) throws ConversionException
ConversionExceptionpublic static final Float convertToFloat(String string) throws ConversionException
ConversionExceptionpublic static final Long convertToLong(String string) throws ConversionException
ConversionExceptionpublic static final Integer convertToInteger(String string) throws ConversionException
ConversionExceptionpublic static final Short convertToShort(String string) throws ConversionException
ConversionExceptionpublic static final Boolean convertToBoolean(String string) throws ConversionException
ConversionExceptionpublic static final Date convertToDate(String value) throws ConversionException
ConversionExceptionpublic static final Double convertToDouble(Object value) throws ConversionException
ConversionExceptionpublic static final Integer convertToInteger(Object value) throws ConversionException
ConversionExceptionpublic static List<Short> convertToShortList(List<String> values) throws ConversionException
ConversionExceptionpublic static List<Integer> convertToIntegerList(List<String> values) throws ConversionException
ConversionExceptionpublic static List<Long> convertToLongList(List<String> values) throws ConversionException
ConversionExceptionpublic static List<Float> convertToFloatList(List<String> values) throws ConversionException
ConversionExceptionpublic static List<Double> convertToDoubleList(List<String> values) throws ConversionException
ConversionExceptionpublic static List<Object> convertToObjectList(List<String> values, int type) throws ConversionException
ConversionExceptionpublic static List<Object> convertToObjectList(List<String> values, int[] types) throws ConversionException
ConversionExceptionpublic static final int getDataType(String string)
public static final int[] getDataTypes(String[] strings)
public static final List<Integer> getDataTypes(List<String> strings, List<Integer> currentDatatypes)
public static final int[] getDataTypes(String[] strings, int[] currentDatatypes)
Copyright © 2016. All rights reserved.