Class StringToClassConverter

    • Method Summary

      All Methods Instance Methods Concrete 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).
      java.lang.Object convert​(java.lang.String className, 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).
      • Methods inherited from class java.lang.Object

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

      • StringToClassConverter

        StringToClassConverter()
    • Method Detail

      • canConvert

        public boolean canConvert​(java.lang.Class<?> targetType)
        Description copied from interface: StringToObjectConverter
        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).
        Specified by:
        canConvert in interface StringToObjectConverter
      • convert

        public java.lang.Object convert​(java.lang.String source,
                                        java.lang.Class<?> targetType)
                                 throws java.lang.Exception
        Description copied from interface: StringToObjectConverter
        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).
        Specified by:
        convert in interface StringToObjectConverter
        Throws:
        java.lang.Exception
      • convert

        public java.lang.Object convert​(java.lang.String className,
                                        java.lang.Class<?> targetType,
                                        java.lang.ClassLoader classLoader)
                                 throws java.lang.Exception
        Description copied from interface: StringToObjectConverter
        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 StringToObjectConverter.convert(String, Class). Can be overridden by concrete implementations of this interface that need access to the supplied ClassLoader.

        Specified by:
        convert in interface StringToObjectConverter
        Throws:
        java.lang.Exception