Class TypeStringConverterFactory

  • All Implemented Interfaces:
    StringConverterFactory

    final class TypeStringConverterFactory
    extends java.lang.Object
    implements StringConverterFactory
    Factory for StringConverter looking up types.

    This class is immutable and thread-safe.

    This parses the string format of Type.

    This is achieved thanks to some code copied from Guava. (A Guava dependency is painful when building a Java 6 library for Java 9)

    This parser is incomplete, but handles common cases. It does not handle union types or multi-dimensional arrays.

    • Constructor Detail

      • TypeStringConverterFactory

        private TypeStringConverterFactory()
        Restricted constructor.
    • Method Detail

      • findConverter

        public StringConverter<?> findConverter​(java.lang.Class<?> cls)
        Finds a converter by type.
        Specified by:
        findConverter in interface StringConverterFactory
        Parameters:
        cls - the type to lookup, not null
        Returns:
        the converter, null if not found
        Throws:
        java.lang.RuntimeException - (or subclass) if source code is invalid
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object