Class TypeToStringConverter

    • Constructor Detail

      • TypeToStringConverter

        public TypeToStringConverter()
    • Method Detail

      • handledTypes

        public abstract Class<?>[] handledTypes()
      • convertToString

        public static String convertToString​(Object o)
      • convertFromString

        public static <T> T convertFromString​(String s,
                                              Class<T> requiredType,
                                              String context,
                                              ClassLoader loader,
                                              String[] packageSearchPath)
        * Constructs a new ListTokenizer around s and then calls convertFromString(ArgListTokenizer, Class, String, ClassLoader, String[]) . This class assumes it can read and parse the whole string, otherwise it throws a ArgListTokenizer.ParseException.
        Type Parameters:
        T - The required type.
        Parameters:
        s - The String value to convert.
        requiredType - The type it should be converted to.
        context - An optional property path.
        loader - The class loader to use.
        packageSearchPath - Search path to resolve abbreviated class names.
        Returns:
        s converted to the required type.
      • convertFromString

        public static <T> T convertFromString​(ArgListTokenizer tk,
                                              Class<T> requiredType,
                                              String context,
                                              ClassLoader loader,
                                              String[] packageSearchPath)
        This method is used internally to create an object as specified by the given parse tree.
        Type Parameters:
        T - Type of returned object.
        Parameters:
        tk - The ArgListTokenizer used to split the input String in its parts.
        requiredType - Type the converted parse tree should be compatible with.
        context - Optional property context path.
        loader - The classloader to use.
        packageSearchPath - The package search path.
        Returns:
        The object as specified in the parse tree.
      • lookupConverter

        public static TypeToStringConverter lookupConverter​(Class<?> requiredType)
        Returns the most specific converter responsible for a certain type.
        Parameters:
        requiredType - The required class or interface.
        Returns:
        the converter for this requiredType
        See Also:
        TypeUtil.computeClasses(Class)