Class ObjectUtil

java.lang.Object
org.uitnet.testing.smartfwk.ui.core.utils.ObjectUtil

public class ObjectUtil
extends Object
Author:
Madhav Krishna
  • Constructor Details

    • ObjectUtil

      public ObjectUtil()
  • Method Details

    • valueAsString

      public static String valueAsString​(Object obj)
      Convert object (List, Set and java types String, Integer, Double etc.) to string value. List and set are converted into comma separated value.
      Parameters:
      obj -
      Returns:
    • valueAsInteger

      public static Integer valueAsInteger​(Object obj)
    • valueAsLong

      public static Long valueAsLong​(Object obj)
    • valueAsDouble

      public static Double valueAsDouble​(Object obj)
    • valueAsBoolean

      public static Boolean valueAsBoolean​(Object obj)
    • listSetArrayValueAsString

      public static String listSetArrayValueAsString​(Object obj, String delimitter, String valueEnclosingChars)
      This method converts the Array, List and Set type of objects into delimitter separated value. Each value will be enclosed using "valueEnclosingChars". It will not enclose null values.
      Parameters:
      obj - - could be List, Set or Array type
      delimitter - - could be , or any string, if null then it will use default as ,
      valueEnclosingChars - like ' or " or empty/null (denotes no enclosing)
      Returns:
    • findClassConstructor

      public static Constructor<?> findClassConstructor​(Class<?> clazz, Class<?>[] argTypes)
    • findClassMethod

      public static Method findClassMethod​(Class<?> clazz, String methodName, String[] argTypesName)
    • findClassMethod

      public static Method findClassMethod​(Class<?> clazz, String methodName, int numArgs)
    • invokeMethod

      public static Object invokeMethod​(Object clazzObj, Method m, Object[] argValues) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
      Throws:
      IllegalAccessException
      IllegalArgumentException
      InvocationTargetException
    • convertObjectToParamValue

      public static ParamValue convertObjectToParamValue​(Object obj)
    • fixValueTypesInParamValueObjects

      public static void fixValueTypesInParamValueObjects​(ParamValue pv1, ValueMatchOperator operator, ParamValue pv2)
    • fixObjectValueAsPerItsType

      public static Object fixObjectValueAsPerItsType​(Object value, ParamValueType valueType)
    • fixArgsValues

      public static void fixArgsValues​(Class<?>[] argsType, Object[] argsValue)
      Used to fix the method arguments value based on the method arguments type.
      Parameters:
      argsType -
      argsValue -
    • convertStringToJavaClassType

      public static String convertStringToJavaClassType​(String typeAsStr)
      Used to convert string to java class type name.
      Parameters:
      typeAsStr - - like String, String[], List, Set, java.util.List, java.util.Set etc.
      Returns:
      converted value as java class type name.