Class ObjectConverter

java.lang.Object
de.hybris.platform.adaptivesearch.util.ObjectConverter

public final class ObjectConverter extends Object
Provides methods for generic object conversion.
  • Field Details

  • Method Details

    • generateConverterKey

      protected static String generateConverterKey(Class<?> sourceClass, Class<?> targetClass)
    • convert

      public static <T> T convert(Object value, Class<T> targetClass) throws AsException
      Converts a value to the given target class.
      Parameters:
      value - - the value
      targetClass - - the target class
      Returns:
      the converted value
      Throws:
      AsException - - if an error occurs during the conversion
    • booleanToString

      public static String booleanToString(Boolean value)
      Converts from Boolean to String.
      Parameters:
      value - - the value to convert
      Returns:
      the converted value
    • stringToBoolean

      public static Boolean stringToBoolean(String value)
      Converts from String to Boolean.
      Parameters:
      value - - the value to convert
      Returns:
      the converted value
    • shortToString

      public static String shortToString(Short value)
      Converts from Short to String.
      Parameters:
      value - - the value to convert
      Returns:
      the converted value
    • stringToShort

      public static Short stringToShort(String value)
      Converts from String to Short.
      Parameters:
      value - - the value to convert
      Returns:
      the converted value
    • integerToString

      public static String integerToString(Integer value)
      Converts from Integer to String.
      Parameters:
      value - - the value to convert
      Returns:
      the converted value
    • stringToInteger

      public static Integer stringToInteger(String value)
      Converts from String to Integer.
      Parameters:
      value - - the value to convert
      Returns:
      the converted value
    • longToString

      public static String longToString(Long value)
      Converts from Long to String.
      Parameters:
      value - - the value to convert
      Returns:
      the converted value
    • stringToLong

      public static Long stringToLong(String value)
      Converts from String to Long.
      Parameters:
      value - - the value to convert
      Returns:
      the converted value
    • floatToString

      public static String floatToString(Float value)
      Converts from Float to String.
      Parameters:
      value - - the value to convert
      Returns:
      the converted value
    • stringToFloat

      public static Float stringToFloat(String value)
      Converts from String to Float.
      Parameters:
      value - - the value to convert
      Returns:
      the converted value
    • doubleToString

      public static String doubleToString(Double value)
      Converts from Double to String.
      Parameters:
      value - - the value to convert
      Returns:
      the converted value
    • stringToDouble

      public static Double stringToDouble(String value)
      Converts from String to Double.
      Parameters:
      value - - the value to convert
      Returns:
      the converted value
    • bigIntegerToString

      public static String bigIntegerToString(BigInteger value)
      Converts from BigInteger to String.
      Parameters:
      value - - the value to convert
      Returns:
      the converted value
    • stringToBigInteger

      public static BigInteger stringToBigInteger(String value)
      Converts from String to BigInteger.
      Parameters:
      value - - the value to convert
      Returns:
      the converted value
    • bigDecimalToString

      public static String bigDecimalToString(BigDecimal value)
      Converts from BigDecimal to String.
      Parameters:
      value - - the value to convert
      Returns:
      the converted value
    • stringToBigDecimal

      public static BigDecimal stringToBigDecimal(String value)
      Converts from String to BigDecimal.
      Parameters:
      value - - the value to convert
      Returns:
      the converted value
    • dateToString

      public static String dateToString(Date value)
      Converts from Date to String.
      Parameters:
      value - - the value to convert
      Returns:
      the converted value
    • stringToDate

      public static Date stringToDate(String value)
      Converts from String to Date.
      Parameters:
      value - - the value to convert
      Returns:
      the converted value