Class ConverterUtil

java.lang.Object
org.apache.dubbo.common.convert.ConverterUtil

public class ConverterUtil extends Object
  • Constructor Details

  • Method Details

    • getConverter

      public Converter<?,?> getConverter(Class<?> sourceType, Class<?> targetType)
      Get the Converter instance from ExtensionLoader with the specified source and target type
      Parameters:
      sourceType - the source type
      targetType - the target type
      Returns:
      See Also:
    • convertIfPossible

      public <T> T convertIfPossible(Object source, Class<T> targetType)
      Convert the value of source to target-type value if possible
      Type Parameters:
      T - the target type
      Parameters:
      source - the value of source
      targetType - the target type
      Returns:
      null if can't be converted
      Since:
      2.7.8