Interface StringToObjectConverter

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      boolean canConvert​(java.lang.Class<?> targetType)
      Determine if this converter can convert from a String to the supplied target type (which is guaranteed to be a wrapper type for primitives — for example, Integer instead of int).
      java.lang.Object convert​(java.lang.String source, java.lang.Class<?> targetType)
      Convert the supplied String to the supplied target type (which is guaranteed to be a wrapper type for primitives — for example, Integer instead of int).
      default java.lang.Object convert​(java.lang.String source, java.lang.Class<?> targetType, java.lang.ClassLoader classLoader)
      Convert the supplied String to the supplied target type (which is guaranteed to be a wrapper type for primitives — for example, Integer instead of int).
    • Method Detail

      • canConvert

        boolean canConvert​(java.lang.Class<?> targetType)
        Determine if this converter can convert from a String to the supplied target type (which is guaranteed to be a wrapper type for primitives — for example, Integer instead of int).
      • convert

        java.lang.Object convert​(java.lang.String source,
                                 java.lang.Class<?> targetType)
                          throws java.lang.Exception
        Convert the supplied String to the supplied target type (which is guaranteed to be a wrapper type for primitives — for example, Integer instead of int).
        Throws:
        java.lang.Exception
      • convert

        default java.lang.Object convert​(java.lang.String source,
                                         java.lang.Class<?> targetType,
                                         java.lang.ClassLoader classLoader)
                                  throws java.lang.Exception
        Convert the supplied String to the supplied target type (which is guaranteed to be a wrapper type for primitives — for example, Integer instead of int).

        The default implementation simply delegates to convert(String, Class). Can be overridden by concrete implementations of this interface that need access to the supplied ClassLoader.

        Throws:
        java.lang.Exception