public class GeneralUtil extends Object
| Constructor and Description |
|---|
GeneralUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Boolean |
convertToBoolean(Object object)
Method to convert object to Boolean type It checks the instance of the object is of different datatype then it
gets the value from the object and casts it to required data type.
|
static Byte |
convertToByte(Object object)
Method to convert object to Byte type It checks the instance of the object is of different datatype then it gets
the value from the object and casts it to required data type.
|
static Character |
convertToCharacter(Object object)
Method to convert object to Character type It checks the instance of the object is of different datatype then it
gets the value from the object and casts it to required data type.
|
static Double |
convertToDouble(Object object)
Method to convert object to Double type It checks the instance of the object is of different datatype then it
gets the value from the object and casts it to required data type.
|
static Enum |
convertToEnum(Class idClass,
Object object)
Method to convert object to Character type It checks the instance of the object is of different datatype then it
gets the value from the object and casts it to required data type.
|
static Float |
convertToFloat(Object object)
Method to convert object to Float type It checks the instance of the object is of different datatype then it gets
the value from the object and casts it to required data type.
|
static Integer |
convertToInteger(Object object)
Method to convert object to Integer type It checks the instance of the object is of different datatype then it
gets the value from the object and casts it to required data type.
|
static Long |
convertToLong(Object object)
Method to convert object to Long type It checks the instance of the object is of different datatype then it gets
the value from the object and casts it to required data type.
|
static Short |
convertToShort(Object object)
Method to convert object to Short type It checks the instance of the object is of different datatype then it gets
the value from the object and casts it to required data type.
|
static Date |
convertToSQLDate(Object object,
DateTimeFormat dateTimeFormat)
Method to convert object to java.sql.Date type It checks the instance of the object is of different datatype then
it gets the value from the object and casts it to required data type.
|
static Time |
convertToSQLTime(Object object,
DateTimeFormat dateTimeFormat)
Method to convert object to java.sql.Tim type It checks the instance of the object is of different datatype then
it gets the value from the object and casts it to required data type.
|
static Timestamp |
convertToSQLTimestamp(Object object,
DateTimeFormat dateTimeFormat)
Method to convert object to java.sql.Timestamp type It checks the instance of the object is of different datatype
then it gets the value from the object and casts it to required data type.
|
static String |
convertToString(Object object)
Method to convert object to String type It returns toString value of object.
|
static StringBuffer |
convertToStringBuffer(Object object)
Method to convert object to String type It returns toString value of object.
|
static StringBuilder |
convertToStringBuilder(Object object)
Method to convert object to String type It returns toString value of object.
|
static Object |
convertToTargetType(Class<?> idClass,
Object object,
Boolean convertEmptyToNull,
DateTimeFormat dateTimeFormat)
Convert the given Class object to an object instance if possible
|
static Date |
convertToUtilDate(Object object,
DateTimeFormat dateTimeFormat)
Method to convert object to java.util.Date type It checks the instance of the object is of different datatype
then it gets the value from the object and casts it to required data type.
|
static String |
createDefaultOutputFolder(String destinationFolder)
Create directory
|
static String |
createFolder(String absoluteLocation)
Creates directory.
|
static Boolean |
dataAlreadyConverted(Class parameterType,
List<Map<String,Object>> convertFrom,
String paramName)
Is the data already converted by the user while loading the data.
|
static Boolean |
fillDataUsingConstructor(Class<?> idClass,
List<Map<String,Object>> convertFrom,
List<org.junit.experimental.theories.PotentialAssignment> finalData,
String paramName,
Collection collectionInstance,
Boolean convertEmptyToNull,
DateTimeFormat dateTimeFormat) |
static String |
getAbsoluteLocation(String location)
Returns absulute path of either the classpath of file location
|
static Constructor |
getConstructor(Class<?> idClass) |
static String |
getCurrentFolder() |
static Double |
getRounded(double valueToRound,
int numberOfDecimalPlaces)
Rounds a value with number of decimals
|
static String |
getStringValue(String paramName,
Map<String,Object> data)
Util method to get the String value
|
static <T> void |
handleJSONData(String expr,
Class<T> idClass,
List<org.junit.experimental.theories.PotentialAssignment> potentialAssignments) |
static Boolean |
isJSON(String expression) |
static boolean |
isStandardObjectInstance(Class<?> idClass) |
static Boolean |
populateJSONData(Class<?> idClass,
List<Map<String,Object>> convertFrom,
List<org.junit.experimental.theories.PotentialAssignment> potentialAssignments,
String paramName) |
public static Double getRounded(double valueToRound, int numberOfDecimalPlaces)
valueToRound - numberOfDecimalPlaces - public static String getStringValue(String paramName, Map<String,Object> data)
paramName - the name of the parameter to get the String value fordata - the data that contains the include Holdings valuepublic static String createDefaultOutputFolder(String destinationFolder)
destinationFolder - public static String getCurrentFolder()
public static String createFolder(String absoluteLocation)
absoluteLocation - public static String getAbsoluteLocation(String location)
location - public static Timestamp convertToSQLTimestamp(Object object, DateTimeFormat dateTimeFormat)
object - The object to convert to SQL TimestampdateTimeFormat - the date time format to usepublic static Date convertToUtilDate(Object object, DateTimeFormat dateTimeFormat)
object - the object to convert to datedateTimeFormat - the date and time format to use to convertpublic static Date convertToSQLDate(Object object, DateTimeFormat dateTimeFormat)
object - the object to convert to SQL DatedateTimeFormat - the user specified date time formatpublic static Time convertToSQLTime(Object object, DateTimeFormat dateTimeFormat)
object - the object to convert to SQL TimedateTimeFormat - the date time format to usepublic static Integer convertToInteger(Object object)
Object - objectpublic static Short convertToShort(Object object)
Object - objectpublic static Long convertToLong(Object object)
Object - objectpublic static Double convertToDouble(Object object)
Object - objectpublic static Float convertToFloat(Object object)
Object - objectpublic static Boolean convertToBoolean(Object object)
Object - objectpublic static Byte convertToByte(Object object)
Object - objectpublic static Character convertToCharacter(Object object)
Object - objectpublic static String convertToString(Object object)
Object - objectpublic static StringBuffer convertToStringBuffer(Object object)
Object - objectpublic static StringBuilder convertToStringBuilder(Object object)
Object - objectpublic static Enum convertToEnum(Class idClass, Object object)
idClass - object - public static Boolean dataAlreadyConverted(Class parameterType, List<Map<String,Object>> convertFrom, String paramName)
parameterType - the type of the input parameterconvertFrom - the data to convert fromparamName - the name of the parameterpublic static Object convertToTargetType(Class<?> idClass, Object object, Boolean convertEmptyToNull, DateTimeFormat dateTimeFormat)
idClass - object - convertEmptyToNull - public static boolean isStandardObjectInstance(Class<?> idClass)
public static Boolean populateJSONData(Class<?> idClass, List<Map<String,Object>> convertFrom, List<org.junit.experimental.theories.PotentialAssignment> potentialAssignments, String paramName)
public static <T> void handleJSONData(String expr, Class<T> idClass, List<org.junit.experimental.theories.PotentialAssignment> potentialAssignments)
public static Boolean fillDataUsingConstructor(Class<?> idClass, List<Map<String,Object>> convertFrom, List<org.junit.experimental.theories.PotentialAssignment> finalData, String paramName, Collection collectionInstance, Boolean convertEmptyToNull, DateTimeFormat dateTimeFormat) throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException
public static Constructor getConstructor(Class<?> idClass)
Copyright © 2014. All rights reserved.