Class TypeUtils


  • final class TypeUtils
    extends java.lang.Object
    Parse the string format of Guava TypeToken.

    This is loaded by reflection only when Guava is on the classpath. It relies on internal methods in Guava that could change in any release.

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

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String EXTENDS  
      private static java.util.Map<java.lang.String,​java.lang.Class<?>> PRIMITIVES  
      private static java.lang.String SUPER  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private TypeUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.lang.reflect.Type doParse​(java.lang.String str)  
      private static java.lang.reflect.ParameterizedType newParameterizedType​(java.lang.Class<?> base, java.lang.reflect.Type... args)  
      (package private) static java.lang.reflect.Type parse​(java.lang.String str)
      Parses the TypeToken string format.
      private static java.util.List<java.lang.String> split​(java.lang.String str)  
      private static java.lang.reflect.Type wildExtendsType​(java.lang.reflect.Type bound)  
      private static java.lang.reflect.Type wildSuperType​(java.lang.reflect.Type bound)  
      • Methods inherited from class java.lang.Object

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

      • PRIMITIVES

        private static final java.util.Map<java.lang.String,​java.lang.Class<?>> PRIMITIVES
    • Constructor Detail

      • TypeUtils

        private TypeUtils()
    • Method Detail

      • parse

        static java.lang.reflect.Type parse​(java.lang.String str)
        Parses the TypeToken string format.
        Parameters:
        str - the string
        Returns:
        the token
      • doParse

        private static java.lang.reflect.Type doParse​(java.lang.String str)
                                               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • split

        private static java.util.List<java.lang.String> split​(java.lang.String str)
      • wildExtendsType

        private static java.lang.reflect.Type wildExtendsType​(java.lang.reflect.Type bound)
                                                       throws java.lang.Exception
        Throws:
        java.lang.Exception
      • wildSuperType

        private static java.lang.reflect.Type wildSuperType​(java.lang.reflect.Type bound)
                                                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • newParameterizedType

        private static java.lang.reflect.ParameterizedType newParameterizedType​(java.lang.Class<?> base,
                                                                                java.lang.reflect.Type... args)
                                                                         throws java.lang.Exception
        Throws:
        java.lang.Exception