Class TypeConversionHelper


  • public class TypeConversionHelper
    extends java.lang.Object
    Class with methods for type conversion.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Object convertTo​(java.lang.Object value, java.lang.Class type)
      Convert the value to a instance of the given type.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TypeConversionHelper

        public TypeConversionHelper()
    • Method Detail

      • convertTo

        public static java.lang.Object convertTo​(java.lang.Object value,
                                                 java.lang.Class type)
        Convert the value to a instance of the given type. The value is converted only if the type can't be assigned from the current type of the value instance.
        Parameters:
        value - the value to be converted
        type - the type of the expected object returned from the conversion
        Returns:
        the converted object, or the input value if the object can't be converted